On Tue, May 20, 2008 at 12:05:46PM +0100, martin f krafft wrote:
Hi folks, I noticed the other day that there are quite a few packages like ttf-bitstream-vera which do the following in /var/lib/dpkg/info/ttf-bitstream-vera.postinst: if [ "$1" = configure -a -x /usr/bin/fc-cache ] then echo -n "Regenerating fonts cache... " HOME=/root fc-cache -f -v 1>/var/log/fontconfig.log 2>&1 || \ (echo "failed; see /var/log/fontconfig.log for more information."; \ exit 1) echo "done." fi This is wrong. Using ()'s creates a subshell, and exit then only exits the subshell, not the postinst (which I believe it's supposed to do). The code either needs an "|| exit $?" appended, or {}'s should be used. Compare
I could be wrong, but if the subshell exits 1, then the entire expression is false, and so if you are using "set -e" like you're supposed to, then the postinst fails. For example, at the prompt, try: (set -e; echo 1; false || (echo error; exit 1); echo 2) which will never print "2". ttf-bitstream-vera isn't using set -e, which is probably a bug. ISTR that policy dictated set -e. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only troff on top of XML: http://crustytoothpaste.ath.cx/~bmc/code/thwack OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Attachment:
signature.asc
Description: Digital signature