tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sh -e changes broke pkgsrc




On May 26, 2008, at 4:55 PM, David Holland wrote:

On Mon, May 26, 2008 at 11:41:40PM +0200, Matthias Drochner wrote:
there's another unclear issue. In bin/32282, if I understand
correctly, dsl@ says that -e failures inside a () subshell should
cause the outside shell to exit also

A subshell invocation is a command as any other.

So dsl is wrong? (I just want to be as clear as possible, since this
whole subject is extremely murky.)

So in the light of what was said before -- if the subshell
return status was caught by a "&&" or so, the outside
shell should not exit. Otherwise, it should.

Well, no, because a subshell isn't a simple command. The standard says
that only failing simple commands cause exits... the question is
whether the failure inside the subshell kills off only the subshell or
the entire caboodle. (Imagine for a moment that () wasn't implemented
by forking; I think that's the premise.)


I got into a long discussion with dsl about this when retrofitting make a couple of years ago. The shell has 2 notions of sub-commands:

()
{}

We came to the conclusion (as I recall) that -e should transition it's behavior inside () for a simple command executed there (and thereby setting it's exit status), but otherwise the same rules applied (where compound statements were not affected by -e)

James




Home | Main Index | Thread Index | Old Index