On Tue, Sep 22, 2026, at 2:51 PM, R. Diez wrote:
> Hi all:
>
> Shells ignore errors by default, and the results are often brittle
> scripts that only work reliably on sunny days. So I have become
> accustomed to these lines at the top of my scripts:
>
> set -o errexit set -o nounset set -o pipefail
>
> Unfortunately, you cannot set these flags in configure.ac, as Autoconf
> generates code which relies in undefined variables being considered
> empty, etc.
>
> But are those flags safe to set in Makefile.am? For example:
>
> SHELL := bash  -o nounset  -o pipefail  -o errexit
>
> or with modern GNU Make versions:
>
> .SHELLFLAGS := -o nounset  -o pipefail  -o errexit  -c
>
> Or will Automake generate some code which may break with those flags?

I doubt that this is safe now, just because it's so easy for code that
won't work with those flags turned on to get written by accident in the
absence of these flags.  However, "make this safe and turn it on by
default when the shell supports it" seems like a desirable goal, and one
I'd support for both Automake and Autoconf.  Is it something you are
interested in working on yourself?

zw

Reply via email to