Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Bugs with (q-) parameter flag
- X-seq: zsh-workers 30407
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Bugs with (q-) parameter flag
- Date: Sat, 14 Apr 2012 10:27:12 -0700
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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