Re: 'set -e' with '!' and '&&' POSIX issue

2016-10-02 Thread Thorsten Glaser
Martijn Dekker dixit:

>http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25
>| 2. The -e setting shall be ignored when executing the compound list
>| following the while, until, if, or elif reserved word, a pipeline
>| beginning with the ! reserved word, or any command of an AND-OR list
>| other than the last.

I checked that, and indeed, the pipeline is part of the AND-OR list,
not vice versa, and yes, this was a bug in mksh. I believe it fixed now
and hope it’s without adding any regressions; testing welcome, as this
will otherwise quickly end up becoming mksh R53b as the freeze for the
next Debian is close :|

Dankjewel,
//mirabilos
-- 
«MyISAM tables -will- get corrupted eventually. This is a fact of life. »
“mysql is about as much database as ms access” – “MSSQL at least descends
from a database” “it's a rebranded SyBase” “MySQL however was born from a
flatfile and went downhill from there” – “at least jetDB doesn’t claim to
be a database”  ‣‣‣ Please, http://deb.li/mysql and MariaDB, finally die!



'set -e' with '!' and '&&' POSIX issue

2016-10-02 Thread Martijn Dekker
There seems to be a POSIX issue with 'set -e' ('set -o errexit') on mksh.

The script:

set -e
! false && false
echo wrong

should not output anything, which is the actual behaviour on every shell
except pdksh and mskh.

This only occurs if the command starts with a '!'. The following script
works correctly on pdksh and mksh:

set -e
true && false
echo wrong

Ref.:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25
| 2. The -e setting shall be ignored when executing the compound list
| following the while, until, if, or elif reserved word, a pipeline
| beginning with the ! reserved word, or any command of an AND-OR list
| other than the last.

Thanks,

- Martijn