Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Fix for ${\var} oddity
- X-seq: zsh-workers 43921
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Fix for ${\var} oddity
- Date: Fri, 21 Dec 2018 00:11:09 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=lURpj0XYqpJeqPNp1ApwZ/55o3bwGsRXiDlF4/MjV+g=; b=vVa6julUJjA45XxB3jODKEsnFElIGG3eb7k9EmkG/7HLyWy1gkPmXrDtHrdBw/A4Bl nP0OixUhi8QFEuS7v8XsQzn2uUA2jaoxnQAke6EU86qXuYp3btWYRVz6HxvbUPrddHvm 06F9KAeEaiIHnT1WBdaX5tzhDjstmXCzd01gn+uZOfk4AiQwAG4vYMchQlnBd7goRZBo dng/hLwqGp+/DkzDGOFfDAMCUPemhlViMG4x5JGuMNz/EMJGRbmkPoY/U4Yv4x5ih/DS Ej16ozZjGWEpVCYvfuhqHGWF9k/2oKyl+0wCcCnimWFZ33T6umW+Gjgef8F1zYQfY7PF loZw==
- In-reply-to: <CAH+w=7bthv3E3Lr3UC9FvroXFcS1W+fDRuS6CLPxy_eyX0szqw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <d7b0451f90bdfe61f48cc1361690180e07158900.camel@ntlworld.com> <b8851c3a50bd8bceba1961f2f764e1a6869481ac.camel@ntlworld.com> <18f684a8-2fec-4ebe-a63e-cf6688ae519f@inlv.org> <CAH+w=7bthv3E3Lr3UC9FvroXFcS1W+fDRuS6CLPxy_eyX0szqw@mail.gmail.com>
On Thu, Dec 20, 2018 at 11:53 PM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> > > The \ is not removed before var expansion, ${\#} is not ${#}
> > > and \# is not a valid var name, nor is \ if this is being parsed
> > > as a substring match on ${\}
> > > so this should be a syntax error
> > > (at least in sh emulation mode).
>
> This one surprised me. Seems to come down to this code in params.c:
>
> 2341 } else if (inbrace && inull(*s)) {
> 2342 /*
> 2343 * Handles things like ${(f)"$(<file)"} by skipping
> 2344 * the double quotes. We don't need to know what was
> 2345 * actually there; the presence of a String or Qstring
> 2346 * is good enough.
> 2347 */
> 2348 s++;
>
> inull() is expected to match a quote there, but it happens to also
> match backslash. Fix in another thread.
diff --git a/Src/subst.c b/Src/subst.c
index ff6750a..60eb333 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2338,7 +2338,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int
zerr("bad substitution");
return NULL;
}
- } else if (inbrace && inull(*s)) {
+ } else if (inbrace && inull(*s) && *s != Bnull) {
/*
* Handles things like ${(f)"$(<file)"} by skipping
* the double quotes. We don't need to know what was
Messages sorted by:
Reverse Date,
Date,
Thread,
Author