dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ron Yorston <rmy@frippery.org>
To: dash@vger.kernel.org, dash@mattwhitlock.name
Subject: Re: Bug in Dash's unquoting of backslashes within backquoted strings
Date: Thu, 21 May 2020 22:38:29 +0100	[thread overview]
Message-ID: <5ec6f4d5.8pMzL3JNioCKa/Fi%rmy@frippery.org> (raw)
In-Reply-To: <b2fe3536-23b8-4d04-8197-701ab50da86f@mattwhitlock.name>

Matt Whitlock wrote:
>A minimal example:
>
>: `: "\\\\
>\\$(bug)"`

>However, when it appears inside a backquoted subcommand (with the 
>backslash characters being appropriately escaped), such as given at the top 
>of this report, then Dash processes it incorrectly:
>
>/bin/sh: 1: bug: not found

This seems to have been introduced by commit 6bbc71d (parser: use
pgetc_eatbnl() in more places).  Reverting the following part of the
commit makes the problem go away:

            case '\\':
-                                if ((pc = pgetc()) == '\n') {
-                   nlprompt();
-                   /*
-                    * If eating a newline, avoid putting
-                    * the newline into the new character
-                    * stream (via the STPUTC after the
-                    * switch).
-                    */
-                   continue;
-               }
+                                pc = pgetc_eatbnl();

Ron

  reply	other threads:[~2020-05-21 21:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 20:06 Bug in Dash's unquoting of backslashes within backquoted strings Matt Whitlock
2020-05-21 21:38 ` Ron Yorston [this message]
2020-05-21 21:57   ` Ron Yorston
2020-05-26 13:19     ` parser: Fix double-backslash nl in old-style command sub Herbert Xu
2020-05-21 22:02   ` Bug in Dash's unquoting of backslashes within backquoted strings Harald van Dijk

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=5ec6f4d5.8pMzL3JNioCKa/Fi%rmy@frippery.org \
    --to=rmy@frippery.org \
    --cc=dash@mattwhitlock.name \
    --cc=dash@vger.kernel.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.
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).