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

Re: PATCH: quote parameter expansion from GLOB_SUBST



On Thu, 14 May 2015 23:50:32 +0200
Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> On 10 May, Peter wrote:
> > the (b) parameter flag to backslash-quote against pattern characters
> 
> Playing with this, I managed to get a BUG message:
> 
> % a='*'
> % echo ${(bqq)a}
>  utils.c:5104: BUG: bad quote type in quotestring
> '*'

I tested one way round (q first) but not the other.

> We've got (q-) for minimal quoting. If - is a sort of parameter to q,
> perhaps we should continue that: (q*) might be more memorable. And
> combining (b) with (q) is a bit odd anyway.

I thought about an argument to q, but nothing struck me as particularly
obvious, so I left q for generic quoting (all forms produced by any q
variant at the moment protect all characters by some means or another so
are e.g. eval safe --- up to bugs).

pws

diff --git a/Src/subst.c b/Src/subst.c
index bf80495..6345e36 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1845,7 +1845,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
 		    break;
 
 		case 'q':
-		    if (quotetype == QT_DOLLARS)
+		    if (quotetype == QT_DOLLARS || QT_BACKSLASH_PATTERN)
 			goto flagerr;
 		    if (s[1] == '-') {
 			if (quotemod)



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