zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Bugs with (q-) parameter flag
Date: Sat, 14 Apr 2012 10:27:12 -0700	[thread overview]
Message-ID: <120414102712.ZM8572@torch.brasslantern.com> (raw)

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


             reply	other threads:[~2012-04-14 17:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-14 17:27 Bart Schaefer [this message]
2012-04-16  9:57 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=120414102712.ZM8572@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).