Ошибка обновления из репозитория в MX Linux

Это происходит потому, что exitвыполняется в подоболочке для exit | cat, а не для exit > /dev/null. Выход из подоболочки не приводит к выходу из основной оболочки:

If the current execution environment is a subshell environment, the shell shall exit from the subshell environment with the specified exit status and continue in the environment from which that subshell environment was invoked

Но конкретная разница подоболочки или не подоболочки указана в разделе 2.12 стандарта POSIX – чтобы процитировать соответствующий отрывок полностью:

A subshell environment shall be created as a duplicate of the shell environment, except that signal traps that are not being ignored shall be set to the default action. Changes made to the subshell environment shall not affect the shell environment. Command substitution, commands that are grouped with parentheses, and asynchronous lists shall be executed in a subshell environment. Additionally, each command of a multi-command pipeline is in a subshell environment; as an extension, however, any or all commands in a pipeline may be executed in the current environment. All other commands shall be executed in the current shell environment.

Здесь exit | catподходит под описание:

each command of a multi-command pipeline is in a subshell environment

И поэтому обычно выполняется в подоболочке. Однако это может застать вас врасплох:

as an extension, however, any or all commands in a pipeline may be executed in the current environment

... Это означает, что это не гарантируется во всех оболочках. Раньше мне приходилось отлаживать код, в котором одна реализация выполняла правую часть конвейера в текущей оболочке, позволяя следующей работать с некоторыми реализациями KSH, но не с другими :

.

cat foo | while read line
do
    X="$line"
done

Поэтому всегда предполагайте, что канал может порождать подоболочку, но не полагайтесь на нее.

0
16.04.2021, 08:06
1 ответ

Я думаю, что это временная проблема с репозиториями Teamviewer. Я нашел следующий обходной путь:

sudo rm -f /etc/apt/sources.list.d/teamviewer.list

Удалите поврежденный файл со списком исходников с помощью приведенной выше команды и попытайтесь получить обновления. Чтобы повторно сгенерировать указанный выше файл, вам необходимо обновить TW, загрузив пакет deb вручную.

3
28.04.2021, 22:52

Теги

Похожие вопросы