Bug 66357 - make POSIX conformance problem ('sh -e' & '+' command-line)
Summary: make POSIX conformance problem ('sh -e' & '+' command-line)
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: 5.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Simon J. Gerraty
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-07 18:00 UTC by Mark D. Baushke
Modified: 2018-05-29 05:22 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark D. Baushke 2004-05-07 18:00:38 UTC
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 FreeBSD /usr/bin/make program generates an error and does not
support the '+' command line flag properly.
(tested on FreeBSD 2.2.8-RELEASE, 3.3-RELEASE, 4.2-RELEASE,
4.10-PRERELEASE and 5.2-RELEASE versions)

My guess is that the .POSIX: directive in the test case would not have
much impact as the sys.mk file seems to be read before the first
Makefile is opened, but I have added that rule to underline that this
change is really only required in order to be POSIX compliant.

Should you wish to retain your existing behavior, that would be fine as
long as the behavior is modified as expected when the .POSIX: directive
is given.

I have consulted with Simon J. Gerraty who commits changes to the NetBSD
version of make as well as providing portable versions of bmake for
other platforms (see URL http://www.crufty.net/help/sjg/bmake.html). He
says he has committed a patch to the NetBSD -current version of the make
program.

Part of the e-mail exchange focused on this problem is found here:

http://mail-index.netbsd.org/tech-toolchain/2004/05/05/0008.html

After my .signature are the log message and URLs for the changes made to
the NetBSD.

Fix: 

Committed to the NetBSD cvs repository on Fri May 7 08:12:15 2004 UTC by sjg

Log message:

Remove use of sh -e when running in compat mode.
Its not posix compliant and serves very little purpose.
With this change compat and jobs modes are consistent wrt how
they treat each line of a script.

Add support for the '+' command line prefix as required by posix.
Lines prefixed with '+' are executed even when -n is given.
[Actually posix says they should also be done for -q and -t]

PR:
Reviewed by: jmc

http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/compat.c.diff?r1=1.53&r2=1.54

http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/nonints.h.diff?r1=1.31&r2=1.32
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/job.c.diff?r1=1.84&r2=1.85
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/unit-tests/Makefile.diff?r1=1.12&r2=1.13
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/unit-tests/test.exp.diff?r1=1.11&r2=1.12
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/unit-tests/posix
How-To-Repeat: How to reproduce the problem:

The following Makefile

 --------------- start Makefile ---------------
.POSIX:
all: x plus sub err
x:
	@echo "Hello,"; false; echo "World"
plus:
	@echo a command
	+@echo "a command prefixed by '+' executes even with -n"
	@echo another command
subs:
	@echo make -n
	@${.MAKE} -f ${MAKEFILE} -n plus
	@echo make -n -j1
	@${.MAKE} -f ${MAKEFILE} -n -j1 plus

err:
	@(echo Now we expect an error...; exit 1)
	@echo "Oops! you shouldn't see this!"
	
 --------------- end Makefile ---------------

The
	make x

command should therefore generate two lines:

	Hello,
	World

with no error on a 'make' command that is POSIX-compliant. 

The
	make -n plus

command should print

	echo a command
	echo "a command prefixed by '+' executes even with -n"
	a command prefixed by '+' executes even with -n
	echo another command

to show that it is not executing the first and last echo command, but
is executing the middle one.

The
	make err

command should print 

	Now we expect an error...

and exit with an error code 1.

Running all of the tests may require adding a few command-line
arguments if the paricular version of make does not support setting
the .MAKE or MAKEFILE macros such as this:

	make .MAKE=/usr/bin/make MAKEFILE=Makefile

However, as those macros are not required by the POSIX standard, you
don't need to worry if they are not being set by default.

 --------------- begin test results for FreeBSD 5.2-RELEASE ---------------
% /usr/bin/make
Hello,
*** Error code 1

Stop in /tmp/mdb.foo.
% /usr/bin/make plus
% /usr/bin/make plus
a command
+@echo "a command prefixed by '+' executes even with -n"
+@echo:No such file or directory
*** Error code 1

Stop in /tmp/mdb.foo.
% /usr/bin/make -n plus
echo a command
+@echo "a command prefixed by '+' executes even with -n"
echo another command
% /usr/bin/make -n .MAKE=/usr/bin/make subs
echo make -n
/usr/bin/make -f Makefile -n plus
echo make -n -j1
/usr/bin/make -f Makefile -n -j1 plus
% /usr/bin/make .MAKE=/usr/bin/make -n subs
echo make -n
/usr/bin/make -f Makefile -n plus
echo make -n -j1
/usr/bin/make -f Makefile -n -j1 plus
% /usr/bin/make err 
Now we expect an error...
*** Error code 1

Stop in /tmp/mdb.foo.
% /usr/bin/make -n err
(echo Now we expect an error...; exit 1)
echo "Oops! you shouldn't see this!"
% pwd
/tmp/mdb.foo
%
 --------------- end test reults for FreeBSD 5.2-RELEASE ---------------
Comment 1 novo 2004-05-08 14:43:45 UTC
On Fri, 7 May 2004, Mark D. Baushke wrote:

>
> >Number:         66357
> >Category:       standards
> >Synopsis:       make POSIX conformance problem ('sh -e' & '+' command-line)
> >Confidential:   no
> >Severity:       non-critical
> >Priority:       low
> >Responsible:    freebsd-standards
> >State:          open
> >Quarter:
> >Keywords:
> >Date-Required:
> >Class:          sw-bug
> >Submitter-Id:   current-users
> >Arrival-Date:   Fri May 07 10:00:38 PDT 2004
> >Closed-Date:
> >Last-Modified:
> >Originator:     Mark Baushke
> >Release:        FreeBSD 5.2-RELEASE i386
> >Organization:
> Juniper Networks, Inc.
> >Environment:
> System: FreeBSD rat52.juniper.net 5.2-RELEASE FreeBSD 5.2-RELEASE #0: Sun Jan 11 04:21:45 GMT 2004 root@wv1u.btc.adaptec.com:/usr/obj/usr/src/sys/GENERIC i386
>
> >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 FreeBSD /usr/bin/make program generates an error and does not
> support the '+' command line flag properly.
> (tested on FreeBSD 2.2.8-RELEASE, 3.3-RELEASE, 4.2-RELEASE,
> 4.10-PRERELEASE and 5.2-RELEASE versions)
>
> My guess is that the .POSIX: directive in the test case would not have
> much impact as the sys.mk file seems to be read before the first
> Makefile is opened, but I have added that rule to underline that this
> change is really only required in order to be POSIX compliant.
>
> Should you wish to retain your existing behavior, that would be fine as
> long as the behavior is modified as expected when the .POSIX: directive
> is given.
>
> I have consulted with Simon J. Gerraty who commits changes to the NetBSD
> version of make as well as providing portable versions of bmake for
> other platforms (see URL http://www.crufty.net/help/sjg/bmake.html). He
> says he has committed a patch to the NetBSD -current version of the make
> program.
>
> Part of the e-mail exchange focused on this problem is found here:
>
> http://mail-index.netbsd.org/tech-toolchain/2004/05/05/0008.html
>
> After my .signature are the log message and URLs for the changes made to
> the NetBSD.
>
> >How-To-Repeat:
> How to reproduce the problem:
>
> The following Makefile
>
>  --------------- start Makefile ---------------
> .POSIX:
> all: x plus sub err
> x:
> 	@echo "Hello,"; false; echo "World"
> plus:
> 	@echo a command
> 	+@echo "a command prefixed by '+' executes even with -n"
> 	@echo another command
> subs:
> 	@echo make -n
> 	@${.MAKE} -f ${MAKEFILE} -n plus
> 	@echo make -n -j1
> 	@${.MAKE} -f ${MAKEFILE} -n -j1 plus
>
> err:
> 	@(echo Now we expect an error...; exit 1)
> 	@echo "Oops! you shouldn't see this!"
>
>  --------------- end Makefile ---------------
>
> The
> 	make x
>
> command should therefore generate two lines:
>
> 	Hello,
> 	World
>
> with no error on a 'make' command that is POSIX-compliant.
>
> The
> 	make -n plus
>
> command should print
>
> 	echo a command
> 	echo "a command prefixed by '+' executes even with -n"
> 	a command prefixed by '+' executes even with -n
> 	echo another command
>
> to show that it is not executing the first and last echo command, but
> is executing the middle one.
>
> The
> 	make err
>
> command should print
>
> 	Now we expect an error...
>
> and exit with an error code 1.
>
> Running all of the tests may require adding a few command-line
> arguments if the paricular version of make does not support setting
> the .MAKE or MAKEFILE macros such as this:
>
> 	make .MAKE=/usr/bin/make MAKEFILE=Makefile
>
> However, as those macros are not required by the POSIX standard, you
> don't need to worry if they are not being set by default.
>
>  --------------- begin test results for FreeBSD 5.2-RELEASE ---------------
> % /usr/bin/make
> Hello,
> *** Error code 1
>
> Stop in /tmp/mdb.foo.
> % /usr/bin/make plus
> % /usr/bin/make plus
> a command
> +@echo "a command prefixed by '+' executes even with -n"
> +@echo:No such file or directory
> *** Error code 1
>
> Stop in /tmp/mdb.foo.
> % /usr/bin/make -n plus
> echo a command
> +@echo "a command prefixed by '+' executes even with -n"
> echo another command
> % /usr/bin/make -n .MAKE=/usr/bin/make subs
> echo make -n
> /usr/bin/make -f Makefile -n plus
> echo make -n -j1
> /usr/bin/make -f Makefile -n -j1 plus
> % /usr/bin/make .MAKE=/usr/bin/make -n subs
> echo make -n
> /usr/bin/make -f Makefile -n plus
> echo make -n -j1
> /usr/bin/make -f Makefile -n -j1 plus
> % /usr/bin/make err
> Now we expect an error...
> *** Error code 1
>
> Stop in /tmp/mdb.foo.
> % /usr/bin/make -n err
> (echo Now we expect an error...; exit 1)
> echo "Oops! you shouldn't see this!"
> % pwd
> /tmp/mdb.foo
> %
>  --------------- end test reults for FreeBSD 5.2-RELEASE ---------------
>
> >Fix:
> Committed to the NetBSD cvs repository on Fri May 7 08:12:15 2004 UTC by sjg
>
> Log message:
>
> Remove use of sh -e when running in compat mode.
> Its not posix compliant and serves very little purpose.
> With this change compat and jobs modes are consistent wrt how
> they treat each line of a script.
>
> Add support for the '+' command line prefix as required by posix.
> Lines prefixed with '+' are executed even when -n is given.
> [Actually posix says they should also be done for -q and -t]
>
> PR:
> Reviewed by: jmc
>
> http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/compat.c.diff?r1=1.53&r2=1.54
>
> http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/nonints.h.diff?r1=1.31&r2=1.32
> http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/job.c.diff?r1=1.84&r2=1.85
> http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/unit-tests/Makefile.diff?r1=1.12&r2=1.13
> http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/unit-tests/test.exp.diff?r1=1.11&r2=1.12
> http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/make/unit-tests/posix
> >Release-Note:
> >Audit-Trail:
> >Unformatted:
> _______________________________________________
> freebsd-standards@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-standards
> To unsubscribe, send any mail to "freebsd-standards-unsubscribe@freebsd.org"
>
>

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.

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

harti
Comment 2 Mark D. Baushke 2004-05-10 17:13:08 UTC
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
Comment 3 novo 2004-05-25 16:43:07 UTC
[CC's removed]

[Sorry for the delay, I just discovered that this is still in my mailbox].

On Mon, 10 May 2004, Mark D. Baushke wrote:

> 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'm currently moving jobs and have no access to my link-list, but
you should be able to find the mailing lists on the opengroup web page.
I know that they are not easy to find - watch for Austing Group.

>
> > 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.

The big problem is things like

HDRS=a.h b.h c.h

install:
 	for i in $(HDRS) ; do cp $$i /dest ; done

If one of the cp's fail, make should abort. That is possible only when
doing sh -e. Otherwise a failing cp will just go by unnoticed.

What kind of fragility did you see?

> 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...

There is a long way to get our make POSIX compliant. I think this should
be done very careful step by step. I have already one change in the pipe
for three months now (standards/57295) - the problem is not to break large
numbers of ports, so I really don't want to comnment on the %POSIX stuff
atm. Perhaps it would be best to open another PR for this so we don't mix
different things.

> I look forward to learning what FreeBSD will do.

I'll try to move our make in the POSIX direction, but, as I said this will
take some time because make is a very central utility to the system.

Let me first get the above PR finished, the I will move on to this one.

harti
Comment 4 Mark D. Baushke 2004-05-25 20:22:10 UTC
Harti Brandt <novo@cs.tu-berlin.de> writes:

> [CC's removed]
> 
> [Sorry for the delay, I just discovered that this is still in my mailbox].
> 
> On Mon, 10 May 2004, Mark D. Baushke wrote:
> 
> > 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'm currently moving jobs and have no access to my link-list, but
> you should be able to find the mailing lists on the opengroup web page.
> I know that they are not easy to find - watch for Austing Group.
> 
> >
> > > 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.
> 
> The big problem is things like
> 
> HDRS=a.h b.h c.h
> 
> install:
>  	for i in $(HDRS) ; do cp $$i /dest ; done
>
> If one of the cp's fail, make should abort. That is possible only when
> doing sh -e. Otherwise a failing cp will just go by unnoticed.

If the POSIX user wants your semantics, doing

install:
	for i in $(HDRS) ; do cp $$i /dest || exit 1; done

should work and is much more explicit about when and how a failure
should occur.
 
> What kind of fragility did you see?

Typically, this has been with projects that use POSIX make programs and
have fairly non-trivial actions for a given rule. Something like this:

failed=0; all=0; xfail=0; xpass=0; skip=0;  srcdir=../../lib; export srcdir;  list='test-getdate.sh';  if test -n "$list"; then  for tst in $list; do  if test -f ./$tst; then dir=./;  elif test -f $tst; then dir=;  else dir="../../lib/"; fi;  if  ${dir}$tst; then  all=`expr $all + 1`;  case "  " in  *" $tst "*)  xpass=`expr $xpass + 1`;  failed=`expr $failed + 1`;  echo "XPASS: $tst";  ;;  *)  echo "PASS: $tst";  ;;  esac;  elif test $? -ne 77; then  all=`expr $all + 1`;  case "  " in  *" $tst "*)  xfail=` expr $xfail + 1`;  echo "XFAIL: $tst";  ;;  *)  failed=`expr $failed + 1`;  echo "FAIL: $tst";  ;;  esac;  else  skip=`expr $skip + 1`;  echo "SKIP: $tst";  fi;  done;  if test "$failed" -eq 0; then  if test "$xfail" -eq 0; then  banner="All $all tests passed";  else  banner="All $all tests behaved as expected ($xfail expected failures)";  fi;  else  if test "$xpass" -eq 0; then  banner="$failed of $all tests failed";  else  banner="$failed of $all tests did not behave as e!
 xpected ($xpass unexpected passes)";  fi;  fi;  dashes="$banner";  skipped="";  if test "$skip" -ne 0; then  skipped="($skip tests were not run)";  test `echo "$skipped" | wc -c` -gt `echo "$banner" | wc -c` &&  dashes="$skipped";  fi;  report="";  if test "$failed" -ne 0 && test -n "bug-LIST@LIST.org"; then  report="Please report to bug-LIST@LIST.org";  test `echo "$report" | wc -c` -gt `echo "$banner" | wc -c` &&  dashes="$report";  fi;  dashes=`echo "$dashes" | sed s/./=/g`;  echo "$dashes";  echo "$ba nner";  test -n "$skipped" && echo "$skipped";  test -n "$report" && echo "$report";  echo "$dashes";  test "$failed" -eq 0;  else :; fi

which the automake folks had used in one of their templates.

> > 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...
> 
> There is a long way to get our make POSIX compliant. I think this should
> be done very careful step by step. I have already one change in the pipe
> for three months now (standards/57295) - the problem is not to break large
> numbers of ports, so I really don't want to comnment on the %POSIX stuff
> atm. Perhaps it would be best to open another PR for this so we don't mix
> different things.

Okay, I'll try to report it sometime next week (after the holiday).

> > I look forward to learning what FreeBSD will do.
> 
> I'll try to move our make in the POSIX direction, but, as I said this will
> take some time because make is a very central utility to the system.
> 
> Let me first get the above PR finished, the I will move on to this one.
> 
> harti

With regard to 57295, I was under the impression that .MAKEFLAGS was not
part of the POSIX standard, but that MAKEFLAGS is. I believe that the
suggested patch modifies the .MAKEFLAGS variable... Of course, the other
interesting problem is that there are still '#ifdef POSIX' fragments
laying around in the /usr/src/usr.bin/make tree to confuse the issue.

I do understand it may take time to get this stuff fixed, but I do think
it is a good design goal.

	Thank you,
	-- Mark
Comment 5 Hartmut Brandt freebsd_committer 2004-07-29 15:33:17 UTC
Hi Mark,

I have committed a slightly changed version of the patches for the
'+' flag. With the original version make will print lines that have
both "+@" as flags, what I think it shouldn't. There is also a comment
somewhere that talks about the flags that should have the '+' flag
added to it.

The 'sh -e' stuff has still to wait.

harti
Comment 6 Enji Cooper freebsd_committer 2015-11-10 10:51:42 UTC
This seems to be an `issue` in bmake? CCing sjg -- this is due to the set -e changes that were added to sys.mk in order to make things backwards compatible with fmake:

$ make -f bug66357.mk all
Hello,
*** Error code 1

Stop.
make: stopped in /usr/src/svn
$ make -f bug66357.mk all -DWITHOUT_SHELL_ERRCTL
Hello,
World
a command
a command prefixed by '+' executes even with -n
another command
make: don't know how to make sub. Stop

make: stopped in /usr/src/svn
$ cat bug66357.mk 
.POSIX:
all: x plus sub err
x:
        @echo "Hello,"; false; echo "World"

plus:
        @echo a command
        +@echo "a command prefixed by '+' executes even with -n"
        @echo another command

subs:
        @echo make -n
        @${.MAKE} -f ${MAKEFILE} -n plus
        @echo make -n -j1
        @${.MAKE} -f ${MAKEFILE} -n -j1 plus

err:
        @(echo Now we expect an error...; exit 1)
        @echo "Oops! you shouldn't see this!"
$ make -VMAKE_VERSION
20151020

Sidenote: fixing the typo (sub -> subs in the targets list) yields this (not sure if that was intentional or accidental):

$ make -f bug66357.mk all -DWITHOUT_SHELL_ERRCTL
Hello,
World
a command
a command prefixed by '+' executes even with -n
another command
make -n
echo a command
echo "a command prefixed by '+' executes even with -n"
a command prefixed by '+' executes even with -n
echo another command
make -n -j1
{ echo a command 
} || exit $?
echo "a command prefixed by '+' executes even with -n"
a command prefixed by '+' executes even with -n
{ echo another command 
} || exit $?
Now we expect an error...
*** Error code 1

Stop.
make: stopped in /usr/src/svn
Comment 7 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:42:13 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 8 Simon J. Gerraty freebsd_committer 2018-05-29 05:22:42 UTC
I think bmake addresses most of the issues mdb raises.