zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: "zstyle -L" doesn't quote properly
Date: Wed, 07 Apr 2021 20:21:52 +0100	[thread overview]
Message-ID: <0b43f5848ea0b03c7204d7380754b50c7c35ce41.camel@ntlworld.com> (raw)
In-Reply-To: <d1aa68f7-3a84-4ccf-834f-a0b672ee48a6@www.fastmail.com>

On Wed, 2021-04-07 at 18:24 +0000, Daniel Shahaf wrote:
> Bart Schaefer wrote on Wed, 07 Apr 2021 18:12 +00:00:
> > On Wed, Apr 7, 2021 at 10:36 AM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > > 
> > > I'll go ahead and commit it, but whoever is working on a fix, feel free
> > > to tweak/extend it as needed.
> > 
> > I don't know how soon I'd be able to look at a fix, but there are two
> > ways we could go here:  One, change the quoting for -L, or two, change
> > the code that defines styles to prohibit strings that need quoting in
> > that syntactic position.
> 
> I assumed we'd take the former option and wrote the test accordingly,
> but if we decide on some behaviour other than what the test expects, we
> can adjust it accordingly.

Using the same function as everywhere else in that neighbourhood, we get

zstyle -e ':completion::*:default' $'[[ $WIDGET =\n(|reverse-)menu-complete ]] && reply=(menu yes select interactive)'

is that OK?  If so it's just a question of updating the test.

./V05styles.ztst: starting.
Test ./V05styles.ztst was expected to fail, but passed.
Was testing: zstyle -L escapes the key (regression: workers/48424)
./V05styles.ztst: test XPassed.

pws

diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c
index cecea6d51..691ba6c2f 100644
--- a/Src/Modules/zutil.c
+++ b/Src/Modules/zutil.c
@@ -200,7 +200,8 @@ printstylenode(HashNode hn, int printflags)
 	else {
 	    printf("zstyle %s", (p->eval ? "-e " : ""));
 	    quotedzputs(p->pat, stdout);
-	    printf(" %s", s->node.nam);
+	    putchar(' ');
+	    quotedzputs(s->node.nam, stdout);
 	}
 	for (v = p->vals; *v; v++) {
 	    putchar(' ');



  reply	other threads:[~2021-04-07 19:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 16:42 Bart Schaefer
2021-04-07 17:36 ` Daniel Shahaf
2021-04-07 18:12   ` Bart Schaefer
2021-04-07 18:24     ` Daniel Shahaf
2021-04-07 19:21       ` Peter Stephenson [this message]
2021-04-07 19:43         ` Bart Schaefer

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=0b43f5848ea0b03c7204d7380754b50c7c35ce41.camel@ntlworld.com \
    --to=p.w.stephenson@ntlworld.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).