standards/66357: make POSIX conformance problem ('sh -e' & '+' command-line flag)

Mark D. Baushke mdb at
Mon May 10 09:13:14 PDT 2004

Harti Brandt <novo at> writes:

> On Fri, 7 May 2004, Mark D. Baushke wrote:
> >
> > >Number:         66357
> > >Category:       standards
> > >Synopsis:       make POSIX conformance problem ('sh -e' & '+' command-line)
> > >Description:
> > Background:
> >
> > POSIX 1003.2-1997 states that each makefile command line is processed
> > as if given to system(3) (see URL
> >
> >
> > POSIX 1003.1-2004 (as well as older versions of the standard) states
> > that system() does not use the "sh -e" command to exit immediately if
> > any untested command fails in non-interactive mode. (see URL
> >
> The 'sh -e' servers a purpose if you have a more
> complicated shell line say a loop. Without -e make will
> not stop even if there is an error in an inner command of
> a shell loop, while with -e it will exit. I'd say that not
> using -e is a posix-bug, not a feature and, in fact, there
> has been thoughts on the austin group mailing list to
> review this.

If you have any particular URLs for those austin group
mailing list threads, I would be interested in reading them.
I tried to do a quick google search and did not meet with
success to finding such a discussion.

> I'd think even if we remove the -e in the posix case, we
> must retain it in the non-posix case.

fwiw: I have found the 'sh -e' feature to be fragile and
more likely to do the wrong thing in a complicated action
rule especially across multiple platforms.

I also wonder if you will also have time to consider how to
deal with a .POSIX: setting in a Makefile after has
already apparently been read in and processed including a
number of .if defined(%POSIX) macros settings being done
already before the first line of the user's Makefile is

For example, consider the following Makefile:

	arflags:;@echo ARFLAGS = ${ARFLAGS}, POSIX = ${%POSIX}

the FreeBSD 5.2-RELEASE /usr/share/mk/ has the conditional:

.if defined(%POSIX)
ARFLAGS         ?=      -rv
ARFLAGS         ?=      rl

but the value that /usr/bin/make will print for ARFLAGS in
this case is

	ARFLAGS = rl, POSIX = 1003.2

rather than the correct POSIX value.

It all makes some sense when one understands that is
read first, but I suspect that most folks trying to use
.POSIX: may consider it a bug rather than a feature to need
to use '%POSIX=1003.2' as an argument on the 'make' command
line since %POSIX may not be set an an environment variable
in the shell.

I look forward to learning what FreeBSD will do.

Thank you for your consideration of these problems.

	-- Mark

More information about the freebsd-standards mailing list