mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
This patch was automatically made with the following command
find -name 'task.yaml' -exec sed -E -i -e 's/^( +)!([^|]+$)/\1not\2/g' {} \;
This looks for all files named "task.yaml" and replaces all occurrences
of "! something..." with "not something..." as long as pipes are not
used.
Pipes are more problematic because for correct semantics we need to
place the "not" command on the part that we actually expect to fail.
For example, consider the following three programs. The input and two
variations of the output program:
! echo foo bar | grep bar # input program
not echo foo bar | grep bar # naive replacement
echo foo bar | not grep bar # correct replacement
A "!" applied to a pipe expression returns the negated exit code of the
pipe. A pipe expression alone returns the exit status of the last
element of the pipe, unless "set -o pipefail" is in effect, which we
disabled a while ago.
Therefore the correct replacement for pipe programs is to negate the
last component. The subsequent patch addresses this.
Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>