Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Bugs with (q-) parameter flag



Test case:

torch% x=( a '' '\b' 'c d' '$e' )

Baseline:

torch% print -rl ${(q)x}  
a
''
\\b
c\ d
\$e

I'm not certain this first one qualifies as a bug.  Is the empty string a
"special character"?

torch% print -rl ${(q-)x}
a
'\b'
'c d'
'$e'

Note that the empty string has disappeared.  Now for some other cases.
First, the expected behavior:

torch% print -rl ${(qq-)x}
zsh: error in flags

Next:

torch% print -rl ${(q-q)x}
'a'
''''
'\\b'
'c\ d'
'\$e'

I'm not sure exactly what's going on there.  It's not the same as either
${(qq)x} or ${(q)$(q-)x}} although it's close to ${(q-)${(q)x}} ... but
turning empty string into '''' can't possibly be right.

[ Incidentally although ${(q-)x} produces "the most readable output" for a
single depth, ${(q-)${(q-)x}} is less readable than ${(q)${(q-)x}} ]

torch% print -rl ${(q-qq)x}
 ../../zsh-4.0/Src/utils.c:4789: BUG: bad quote type in quotestring
 ../../zsh-4.0/Src/utils.c:4789: BUG: bad quote type in quotestring
 ../../zsh-4.0/Src/utils.c:4789: BUG: bad quote type in quotestring
 ../../zsh-4.0/Src/utils.c:4789: BUG: bad quote type in quotestring
 ../../zsh-4.0/Src/utils.c:4789: BUG: bad quote type in quotestring
'a'
''
'\b'
'c d'
'$e'

That one repeats no matter how many q you use, and you can use as many
of them as you want; ${(q-qqqqqq)x} is accepted.  Normally more than 4
repeats of q produces "error in flags".



Messages sorted by: Reverse Date, Date, Thread, Author