From 6509cdfd0ae4980b97b70531c45fb0b45e7f2093 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Thu, 7 Mar 2024 01:08:31 +0100 Subject: [PATCH] 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 4f6af9b5452cc2e6 [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 --- fedora-container-toolbox.ks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fedora-container-toolbox.ks b/fedora-container-toolbox.ks index c64d2b5..dd5c1ba 100644 --- a/fedora-container-toolbox.ks +++ b/fedora-container-toolbox.ks @@ -228,7 +228,7 @@ for file in "${files[@]}"; do done if [ "$ret_val" -ne 0 ]; then - false + exit 1 fi %end