[pkg-fso-maint] [BUG?] Busybox ar exits with code 1 if FILES already exist

Steffen Moeller steffen_moeller at gmx.de
Sat Mar 21 00:32:50 UTC 2009


Hello,

Luca pointed out that

> 2) BASH (list) exit status is not taken into account by `set -e`
> 
>    We use the second every day (not only in the pkg-fso stuff), thus
>    clearly understanding how it works (especially WRT the docs) is a win
>    for everyone.

damn right. I just played with it a bit. It seems like a bash-bug or at least a
bash-inconsistency with regard to what set -e interprets. The (list) have a
return value, so the man page says, that is the exit status (Luca quote that before).
In consequence, the ()s should be treated like a function that has a return value.

The script

set -e
retOne {
	return 1
}
retOne
echo "will not be reached"

will not reach the echo line. Also

if retOne; then
	echo "will not be reached"
else
	echo "will be reached"
fi

will always chose the else branch, and is behaving just like

if (cat /dontexist); then
	echo "will not be reached"
else
	echo "will be reached"
fi


So, to have the echo reached in

set -e
(cat /dontexist)
echo "should not be reached but is"

seems inconsistent.


Another issue is that

set -e
(cat /dontexist; echo something)

does execute the echo. And so does

(set -e; cat /dontexist; echo something)

This should not happen, the command execution environment should have inherited the
settings from its parent. At least

(cat /dontexist && echo something)

works as expected :)

The page
http://tiswww.case.edu/php/chet/bash/bashtop.html#Bugs
explains to use the tool bashbug to report bugs. If it
is a bug. Luca?

Many greetings

Steffen



More information about the pkg-fso-maint mailing list