1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

hooks: Fix dkimpy's diff check

When running a diff for dkimpy's output, we expect that diff to exit with
non-zero code.

Unfortunately, the way we set that expectation (by prefixing the diff
invocation with `!` is incorrect.

Running `! diff ...` will not cause the hook to fail if diff exits with
0, instead `!` will cause the exit code to be ignored.

This patch fixes the problem by running `diff ... && exit 1` instead.

This was caught by shellcheck, https://www.shellcheck.net/wiki/SC2251.
This commit is contained in:
Alberto Bertogli
2022-08-27 23:58:26 +01:00
parent e85c31782b
commit 7e38a877e8
2 changed files with 4 additions and 4 deletions

View File

@@ -107,9 +107,9 @@ if [ "$AUTH_AS" != "" ] && command -v dkimsign >/dev/null; then
# dkimpy doesn't provide a way to just show the new
# headers, so we have to compute the difference.
# ALSOCHANGE(test/t-19-dkimpy/config/hooks/post-data)
! diff --changed-group-format='%>' \
diff --changed-group-format='%>' \
--unchanged-group-format='' \
"$TF" "$TF.dkimout"
"$TF" "$TF.dkimout" && exit 1
rm "$TF.dkimout"
else
# driusan/dkim

View File

@@ -31,9 +31,9 @@ if [ "$AUTH_AS" != "" ]; then
# dkimpy doesn't provide a way to just show the new headers, so we
# have to compute the difference.
# ALSOCHANGE(etc/chasquid/hooks/post-data)
! diff --changed-group-format='%>' \
diff --changed-group-format='%>' \
--unchanged-group-format='' \
"$TF" "$TF.dkimout"
"$TF" "$TF.dkimout" && exit 1
rm "$TF.dkimout"
else
# NOTE: This is using driusan/dkim instead of dkimpy, because dkimpy can't be