[Bug 1179287] Re: un-nice things in “set -x”
Thorsten Glaser
1179287 at bugs.launchpad.net
Sun Jul 21 22:07:42 CEST 2013
Fix committed, will be in R47.
*** Please test! ***
** Changed in: mksh
Importance: Undecided => Medium
** Changed in: mksh
Status: New => Fix Committed
--
You received this bug notification because you are subscribed to PLD
Linux.
https://bugs.launchpad.net/bugs/1179287
Title:
un-nice things in “set -x”
Status in The MirBSD Korn Shell:
Fix Committed
Status in PLD Linux Distribution:
Confirmed
Bug description:
One:
tg at blau:~ $ mksh-R41c -xc $'cat <<"EOF"\nfoo\nEOF\n'
+ cat
+ <<"EOF"
foo
tg at blau:~ $ mksh -xc $'cat <<"EOF"\nfoo\nEOF\n'
+ <<"EOF"cat
foo
Problem: no whitespace after here document marker.
Two:
tg at blau:~ $ mksh -xc 'foo=$(bash --version 2>&1 | head -1); echo "=$foo="'
+ + head -1
+ foo='+ + 2>&1 bash --version'
+ echo '=+ + 2>&1 bash --version='
=+ + 2>&1 bash --version=
tg at blau:~ $ mksh-R41c -xc 'foo=$(bash --version 2>&1 | head -1); echo "=$foo="'
+ bash --version
+ head -1
+ 2>&1
+ foo=GNU bash, version 2.05b.0(1)-release (i386-ecce-mirbsd10)
+ echo =GNU bash, version 2.05b.0(1)-release (i386-ecce-mirbsd10)=
=GNU bash, version 2.05b.0(1)-release (i386-ecce-mirbsd10)=
tg at blau:~ $ mksh -xc 'foo=$(bash --version 2>&1 | head -1); echo "=$foo="'
+ + head -1
+ foo='+ + 2>&1 bash --version'
+ echo '=+ + 2>&1 bash --version='
=+ + 2>&1 bash --version=
Questionable: redirection in effect while printing trace.
Maybe not so nice: PS4 shown twice (what happens with subsequent things?)
Given: stderr redirections/parsing never safe while “set -x” is in effect.
But maybe we can do better? Something like a trace fd?
tg at blau:~ $ mksh-R41c -xc 'foo=$((echo foo; bash --version) 2>&1 | head -1); echo "=$foo="'
+ 2>&1
+ head -1
+ foo=+ echo foo
+ echo =+ echo foo=
=+ echo foo=
tg at blau:~ $ mksh -xc 'foo=$((echo foo; bash --version) 2>&1 | head -1); echo "=$foo="'
+ + head -1
+ foo='+ 2>&1 + echo foo'
+ echo '=+ 2>&1 + echo foo='
=+ 2>&1 + echo foo=
This clearly shows that having the redirection in effect is not a new thing,
it just affects more cases now. (The “+ 2>&1 +” is also a cosmetic.)
Maybe some sort of buffering or pre-preparing the output? Have to look
at this again.
Thanks to arekm from PLD Linux for reporting these issues.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mksh/+bug/1179287/+subscriptions
More information about the pld-bugs
mailing list