zsh-workers
 help / color / mirror / code / Atom feed
* Bugs with (q-) parameter flag
@ 2012-04-14 17:27 Bart Schaefer
  2012-04-16  9:57 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Schaefer @ 2012-04-14 17:27 UTC (permalink / raw)
  To: zsh-workers

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".


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-16 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-14 17:27 Bugs with (q-) parameter flag Bart Schaefer
2012-04-16  9:57 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).