Op 17-10-16 om 21:40 schreef Martijn Dekker:
> I need this capability for my shell library to support ksh93. If anyone
> can think of any workarounds, please let me know.

Of course I can't just let stuff like this go...

The bug occurs under really bizarrely specific circumstances.

This works fine:

$ (echo ${.sh.subshell}; echo ${.sh.subshell})
1
1

This works fine:

$ echo $( (echo ${.sh.subshell}; echo ${.sh.subshell}) )
2 2

But look what happens if you add a redirection, even a no-op one like 1>&1:

$ echo $( (echo ${.sh.subshell} 1>&1; echo ${.sh.subshell} 1>&1) )
2 0

And:

$ echo $( (echo ${.sh.subshell} 1>&2; echo ${.sh.subshell} 1>&2) )
2
0

BUT this works fine again:

$ echo $( (echo ${.sh.subshell} 1>&2; echo ${.sh.subshell} 1>&2) 2>&1 )
2 2

Also, with non-command substitution subshells I can't seem to trigger
the bug at all:

$ (echo ${.sh.subshell} 1>&1; echo ${.sh.subshell} 1>&1)
1
1
$ ( (echo ${.sh.subshell} 1>&1; echo ${.sh.subshell} 1>&1) )
2
2

So it looks like this bug is triggered under some kind of bizarre
combination of circumstances related to command substitution and output
redirection.

- Martijn

_______________________________________________
ast-developers mailing list
ast-developers@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to