Public bug reported:
POSIX set description says:
-e
When this option is on, if a simple command fails for any
of the reasons listed in
[348]Consequences of Shell Errors or returns an exit status
value >0, and is not part of the
compound list following a while, until, or if keyword, and is not
a part of an AND or OR list,
and is not a pipeline preceded by the ! reserved word, then the shell
shall immediately exit.
But all pdksh-derived shells including posh do:
tg@blau:~ $ mksh -c 'set -e; bla() { [ -x /nonexistant ] && /nonexistant; };
bla; echo x$?'; echo y$?
x1
y0
Instead of:
tg@freewrt:~ $ ksh93 -c 'set -e; bla() { [ -x /nonexistant ] && /nonexistant;
}; bla; echo x$?'; echo y$?
y1
I believe mksh may be too lax returning an error here. Discovered while
helping Natureshadow with script corner cases caused by Debian’s damned
“set -e” requirement. This should not affect BSD make negatively.
Hm, actually, the turning point is here:
tg@blau:~ $ mksh-R36b -c 'set -e; bla() { [ -x /nonexistant ] && /nonexistant;
}; bla; echo x$?'; echo y$?
y1
tg@blau:~ $ mksh-R37 -c 'set -e; bla() { [ -x /nonexistant ] && /nonexistant;
}; bla; echo x$?'; echo y$?
x1
y0
This means oksh may not be affected.
** Affects: mksh
Importance: Low
Status: New
** Tags: needs-posix-conformance-review
--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/1104543
Title:
pdksh: set -e interop with functions (possibly) wrong
Status in The MirBSD Korn Shell:
New
Bug description:
POSIX set description says:
-e
When this option is on, if a simple command fails for
any of the reasons listed in
[348]Consequences of Shell Errors or returns an exit status
value >0, and is not part of the
compound list following a while, until, or if keyword, and is
not a part of an AND or OR list,
and is not a pipeline preceded by the ! reserved word, then the
shell shall immediately exit.
But all pdksh-derived shells including posh do:
tg@blau:~ $ mksh -c 'set -e; bla() { [ -x /nonexistant ] && /nonexistant; };
bla; echo x$?'; echo y$?
x1
y0
Instead of:
tg@freewrt:~ $ ksh93 -c 'set -e; bla() { [ -x /nonexistant ] && /nonexistant;
}; bla; echo x$?'; echo y$?
y1
I believe mksh may be too lax returning an error here. Discovered
while helping Natureshadow with script corner cases caused by Debian’s
damned “set -e” requirement. This should not affect BSD make
negatively.
Hm, actually, the turning point is here:
tg@blau:~ $ mksh-R36b -c 'set -e; bla() { [ -x /nonexistant ] &&
/nonexistant; }; bla; echo x$?'; echo y$?
y1
tg@blau:~ $ mksh-R37 -c 'set -e; bla() { [ -x /nonexistant ] && /nonexistant;
}; bla; echo x$?'; echo y$?
x1
y0
This means oksh may not be affected.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1104543/+subscriptions