All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Smith <paul@mad-scientist.net>
To: dash@vger.kernel.org
Subject: Failure of nested substring processing inside double-quotes
Date: Mon, 06 Oct 2014 16:03:13 -0400	[thread overview]
Message-ID: <1412625793.29340.94.camel@mad-scientist.net> (raw)

Hi all.  I recently found a bug in dash's handling of substring
processing, when the variable is contained within quotes.

In bash, this works:

  bash$ echo $PWD
  /home/psmith

  bash$ echo ${PWD%${PWD##*/}}.
  /home/.

  bash$ echo "${PWD%${PWD##*/}}."
  /home/.

which is what I expect.  However, in dash we get:

  dash$ echo $PWD
  /home/psmith

  dash$ echo ${PWD%${PWD##*/}}.
  /home/.

  dash$ echo "${PWD%${PWD##*/}}."
  .

Whoops!  Inside double-quotes dash is mishandling the nested string
substitution.  If I break it up into two steps it works OK, regardless
of whether or not it's quoted.

This is dash 0.5.7-4ubuntu1 (from Ubuntu GNOME 14.04).


             reply	other threads:[~2014-10-06 20:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06 20:03 Paul Smith [this message]
2014-10-08  2:28 ` Failure of nested substring processing inside double-quotes Herbert Xu
2014-10-08  5:08   ` Paul Smith

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=1412625793.29340.94.camel@mad-scientist.net \
    --to=paul@mad-scientist.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.