-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Karl Berry on 1/12/2009 5:22 PM: > Meanwhile, even after that message, gendocs.sh ran to completion > with an exit status of 0, so someone is failing to propogate the > error status properly. > > I thought it was more useful to have the script generate everything it > could, even if errors, for the sake of debugging/etc. But if you think > it's better to use sh -e, I can be persuaded.
sh -e is a portability nightmare. The POSIX folks just had a debate about how it should behave, with the conclusion that almost every shell out there has a different interpretation of the older ambiguous requirements. There is a proposal for wording for how it will behave, based on ksh88's handling (as that seemed to be the least controversial, and matches the intent, even if not the wording, of the original POSIX specification for set -e). With the new wording, the hope is that future implementations will be consistent, but even then, the definition still has surprises: https://www.opengroup.org/sophocles/show_mail.tpl?CALLER=index.tpl&source=L&listname=austin-review-l&id=2655 Application writers should avoid relying on set -e within functions. For example, in the following script: set -e start() { some-server echo some-server started successfully } start || echo >&2 some-server failed the -e setting is ignored within the function body (because the function is a command in an AND-OR list other than the last). Therefore if some-server fails, the function carries on to echo "server started successfully", and the exit status of the function is zero (which means "server failed" is not output). So since gendocs.sh uses shell functions, set -e might not be the best idea. I'd still like to see the overall exit status be non-zero if any of the intermediate steps fail, even though I do like the fact that it tries all formats in spite of failures. - -- Don't work too hard, make some time for fun as well! Eric Blake [email protected] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknMy7oACgkQ84KuGfSFAYDsiwCcDxj8Jbqhj5H6vvP6C13dVm7R PN8An0IT90ba/K52Fk0kuIcvWrkx5IvQ =Qk5a -----END PGP SIGNATURE-----
