Failure of nested substring processing inside double-quotes

Bug #1378625 reported by Paul Smith
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
dash (Ubuntu)
New
Undecided
Unassigned

Bug Description

lsb_release -rd:
Description: Ubuntu 14.04.1 LTS
Release: 14.04

apt-cache policy dash
dash:
  Installed: 0.5.7-4ubuntu1
  Candidate: 0.5.7-4ubuntu1
  Version table:
 *** 0.5.7-4ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

FYI, I reported the bug below on the dash mailing list and got this response from Herbert Xu:

> This is already fixed in the current git tree, by the commit:
>
> commit a7c21a6f4cb42d967854cae954efd4ee66bdea9c
> Author: Herbert Xu <email address hidden>
> Date: Fri Aug 23 20:04:12 2013 +1000
>
> [EXPAND] Propagate EXP_QPAT in subevalvar

I checked dash_0.5.8-1_amd64.deb from Debian experimental and this bug seems to be fixed there as well (but still broken in Debian sid, where the current version is dash_0.5.7-4_amd64.deb).

----------
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.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.