Re: [bug] within 'eval', -e/-o errexit appears active, but is inactive

2019-12-29 Thread Thorsten Glaser
Martijn Dekker dixit:

> I noticed something strange while executing some 'eval'-ed commands: the -e/-o
> errexit appears to become active out of nowhere.
>
> $ mksh -c 'echo $-; eval '\''echo $-'\''; echo $-'
> hc
> ehc
> hc

Found to be caused by reusing bit7 of the ERREXIT flag for
nefarious purposes; fixed, but we could not get completely
rid of the flag.

> However, both pdksh and mksh render 'set -e' ineffective for eval'ed commands,
> which is a bug in itself; no other shell including ksh93 shares this 
> behaviour.
> Thus the expected output for the last command above is 'hc' and nothing else.

When run under -e of course.

Fixed, this was way harder.

Thanks,
//mirabilos
-- 
This space for rent.

https://paypal.me/mirabilos to support my work.


[bug] within 'eval', -e/-o errexit appears active, but is inactive

2019-07-07 Thread Martijn Dekker
I noticed something strange while executing some 'eval'-ed commands: the 
-e/-o errexit appears to become active out of nowhere.


$ mksh -c 'echo $-; eval '\''echo $-'\''; echo $-'
hc
ehc
hc

But it looks like it's appearances only; it's not actually effective.

$ mksh -c 'eval '\''echo $-; false; echo phantom e'\'
ehc
phantom e

I tested mksh versions down to R49 and they all have this bug. However, 
its ancestor pdksh does not have this bug.


However, both pdksh and mksh render 'set -e' ineffective for eval'ed 
commands, which is a bug in itself; no other shell including ksh93 
shares this behaviour. Thus the expected output for the last command 
above is 'hc' and nothing else.


Thanks,

- M.

--
modernish -- harness the shell
https://github.com/modernish/modernish