scripts/decodecode: Return 0 on success
PATCH 1/1 scripts/decodecode: Return 0 on success
The decodecode script always returns an exit code of 1, regardless of whether the operation was successful or not. This is because the "cleanup" function, which is registered to run on any script exit via "trap cleanup EXIT", contains an unconditional "exit 1".
Remove the "exit 1" from the "cleanup" function so that it only performs the necessary file cleanup without forcing a non-zero exit status.
Do that to ensure successful script executions now exit with code 0. Exits due to errors are all handled by the "die()" function and will still correctly exit with code 1.
--- scripts/decodecode | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/decodecode +1 -2
@@ -12,7 +12,6 @@ faultlinenum=1 cleanup() { rm -f $T $T.s $T.o $T.oo $T.aa $T.dis - exit 1 } die() {
@@ -49,7 +48,7 @@ done if [ -z "$code" ]; then rm $T - exit + die "Code line not found" fi echo $code
Signature · 1 line
2.53.0.851.ga537e3e6e9-goog
Quoted 25 lines · On Wed, 18 Mar 2026 15:05:45 +0000 Patrick Bellasi <[email protected]> wrote:
The decodecode script always returns an exit code of 1, regardless of whether the operation was successful or not. This is because the "cleanup" function, which is registered to run on any script exit via "trap cleanup EXIT", contains an unconditional "exit 1".
Remove the "exit 1" from the "cleanup" function so that it only performs the necessary file cleanup without forcing a non-zero exit status.
Do that to ensure successful script executions now exit with code 0. Exits due to errors are all handled by the "
die()" function and will still correctly exit with code 1....
scripts/decodecode +0
-1@@ -12,7 +12,6 @@ faultlinenum=1 cleanup() { rm -f $T $T.s $T.o $T.oo $T.aa $T.dis - exit 1 } die() {
scripts/decodecode done · line 54
Quoted 8 lines
scripts/decodecode +1
-1@@ -49,7 +48,7 @@ done if [ -z "$code" ]; then rm $T - exit + die "Code line not found" fi echo $code
Seems reasonable. Randy added this in 2008 - I'm sure he can remember why ;)
Randy Dunlap
Acked-byQuoted 6 lines · Andrew Morton
Quoted 4 lines · On Wed, 18 Mar 2026 15:05:45 +0000 Patrick Bellasi <[email protected]> wrote:
The decodecode script always returns an exit code of 1, regardless of whether the operation was successful or not. This is because the "cleanup" function, which is registered to run on any script exit via "trap cleanup EXIT", contains an unconditional "exit 1".
Who would do that? and why? ;)
Quoted 27 lines
Quoted 27 lines
Remove the "exit 1" from the "cleanup" function so that it only performs the necessary file cleanup without forcing a non-zero exit status.
Do that to ensure successful script executions now exit with code 0. Exits due to errors are all handled by the "
die()" function and will still correctly exit with code 1....
scripts/decodecode +1
-2@@ -12,7 +12,6 @@ faultlinenum=1 cleanup() { rm -f $T $T.s $T.o $T.oo $T.aa $T.dis - exit 1 } die() {@@ -49,7 +48,7 @@ done if [ -z "$code" ]; then rm $T - exit + die "Code line not found" fi
Quoted 4 lines
scripts/decodecode done · line 54
Quoted 1 line
scripts/decodecode +0
-0echo $codeSeems reasonable. Randy added this in 2008 - I'm sure he can remember why ;)
Thanks, Andrew. NFI.
Thanks for the patch.
Signature · 1 line
~Randy