Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 May 2004 09:20:26 -0700 (PDT)
From:      "Mark D. Baushke" <mdb@juniper.net>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/66357: make POSIX conformance problem ('sh -e' & '+' command-line flag) 
Message-ID:  <200405101620.i4AGKQ74085412@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/66357; it has been noted by GNATS.

From: "Mark D. Baushke" <mdb@juniper.net>
To: harti@FreeBSD.ORG
Cc: FreeBSD-gnats-submit@FreeBSD.ORG,
	Paul Eggert <eggert@cs.ucla.edu>,
	"Simon J. Gerraty" <sjg@crufty.net>, freebsd-standards@FreeBSD.ORG
Subject: Re: standards/66357: make POSIX conformance problem ('sh -e' & '+' command-line flag) 
Date: Mon, 10 May 2004 09:13:08 -0700

 Harti Brandt <novo@cs.tu-berlin.de> 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
 > > http://www.opengroup.org/onlinepubs/009695399/utilities/make.html)
 > >
 > > 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
 > > http://www.opengroup.org/onlinepubs/009695399/functions/system.html)
 ...
 > 
 > 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 sys.mk 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
 processed...
 
 For example, consider the following Makefile:
 
 	.POSIX:
 	arflags:;@echo ARFLAGS = ${ARFLAGS}, POSIX = ${%POSIX}
 
 the FreeBSD 5.2-RELEASE /usr/share/mk/sys.mk has the conditional:
 
 .if defined(%POSIX)
 ARFLAGS         ?=      -rv
 .else
 ARFLAGS         ?=      rl
 .endif
 
 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 sys.mk 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405101620.i4AGKQ74085412>