1
1
mirror of https://pagure.io/fedora-kickstarts.git synced 2026-07-24 23:26:00 +00:00

container-toolbox: Use 'exit 1', not false(1), to indicate failure

It's not obvious that merely a non-zero exit code from a command is
enough to fail a scriptlet.  There are commands in the %pre scriptlet
that have been returning with non-zero exit codes for a long time
without ever failing the build [1].

It's possible that the rules are different for the %pre and %post
scriptlets, or that it's the exit code of the last command that
determines the status of the scriptlet [2].  Even if that's the case,
they are both very flimsy situations.  If new tests are added, then only
one of them is going to be the last one.

Therefore, it's better to make things as obvious as possible.

The test originally came from the Container/Dockerfile equivalent of the
fedora-toolbox OCI images [3], where false(1) was used in a RUN
instruction, and it lacked any ambiguity.

[1] Commit 4f6af9b545

[2] https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/

[3] Toolbx commit ff1212e1034d489f
    https://github.com/containers/toolbox/commit/ff1212e1034d489f
    https://github.com/containers/toolbox/pull/1226

https://pagure.io/fedora-kickstarts/pull-request/1028
This commit is contained in:
Debarshi Ray 2024-03-07 01:08:31 +01:00
parent be915a04d8
commit 6509cdfd0a

View File

@ -228,7 +228,7 @@ for file in "${files[@]}"; do
done
if [ "$ret_val" -ne 0 ]; then
false
exit 1
fi
%end