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

Re: "zstyle -L" doesn't quote properly



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@xxxxxxxxxxxxxxxxxx> 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(' ');





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