Subject: Re: make -j and failure modes
To: Alan Barrett <apb@cequrux.com>
From: Robert Elz <kre@munnari.OZ.AU>
List: tech-userlevel
Date: 12/12/2003 01:36:27
    Date:        Thu, 11 Dec 2003 13:31:05 +0200
    From:        Alan Barrett <apb@cequrux.com>
    Message-ID:  <20031211113104.GC28335@apb.cequrux.com>

  | Yes.  And, for similar reasons, I'd be amazed if somebody said that
  | 
  | 	sh -e -c 'false; echo foo'
  | and
  | 	sh -e -c '(false); echo foo'
  | 
  | should behave differently.  But you, and POSIX, seem to be saying that
  | they should.

As Ben Harris (I think) pointed out earlier, someone has to end up being
amazed, sometimes, here.  Given two (non-grouped) command lines

	false
	false && echo foo

and the two (grouped) "equivalent" commands

	(false)
	(false && echo foo)

There's no way to make the two pairs behave the same in both cases,
without requiring absolutely absurd things of the shell.

The question is which is more likely, and more reasonable.   Personally
I don't find (false) a very likely command sequence to encounter...

  | What I have learned from this discussion is that the behaviour of sh -e
  | is either so vaguely defined

No, I believe it is quite precise.

  | or so counter-intuitively defined

I don't believe it is that either.

  | or so inconsistently implemented

I don't even believe it is that - rather, I simply don't believe that
anyone is doing much in the way of serious maintenance on the SysV
shells, to update them to POSIC conformance (the BSD world has changed
lots of code which wasn't POSIX - where changed affected SysV, relatively
little has been done).   Of course, that's partly because none of the
commercial vendors can afford to be in any way not bug-for-bug compatible
with everyone else, it is almost impossible to ever simply change something
as a solitary vendor.  It is just the (many vendors of) the Sys V shells
that are behaving differently - just about every other (independently
created) shell is doing things the POSIX way.

  | that portable scripts and makefiles should not rely on it.

This I absolutely agree with.   But mostly because it is a dumb idea,
regardless of its actual specification.

kre