[Bug 1179287] [NEW] un-nice things in “set -x”

Launchpad Bug Tracker 1179287 at bugs.launchpad.net
Wed Jun 26 17:48:43 CEST 2013


You have been subscribed to a public bug:

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.

** Affects: pld-linux
     Importance: Undecided
         Status: Confirmed

-- 
un-nice things in “set -x”
https://bugs.launchpad.net/bugs/1179287
You received this bug notification because you are subscribed to PLD Linux.


More information about the pld-bugs mailing list