[Bug 1689648] [NEW] removing open bracket ([) via ${var#[} does not work.

Scott Moser smoser at ubuntu.com
Tue May 9 20:30:32 UTC 2017


Public bug reported:

dash in 14.04 has an odd bug in /bin/sh.
   $ var="[abc"
   $ echo "${var#[}"
   [abc

   That *should* output just 'abc' (and does everywhere other than
14.04).

It is fairly easily workaroundable by quoting the '[':
   $ var="[abc"
   echo ${var#"["}


To demonstrate:
$ lxc launch ubuntu-daily:trusty shbug
$ lxc exec shbug /bin/bash

% /bin/sh -c 'v=$0; echo ${v#[}' "[abc"
[abc

% dpkg -S /bin/sh
diversion by dash from: /bin/sh
diversion by dash to: /bin/sh.distrib
dash: /bin/sh

% dpkg-query --show dash
dash  0.5.7-4ubuntu1
% exit

## show that on host, this works as expected.
$ /bin/sh -c 'v=$0; echo ${v#[}' "[abc"
abc
$ dpkg-query --show dash
dash  0.5.8-2.3ubuntu1

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: dash 0.5.7-4ubuntu1
ProcVersionSignature: Ubuntu 4.10.0-20.22-generic 4.10.8
Uname: Linux 4.10.0-20-generic i686
ApportVersion: 2.14.1-0ubuntu3.23
Architecture: i386
Date: Tue May  9 20:13:57 2017
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=C.UTF-8
SourcePackage: dash
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: dash (Ubuntu)
     Importance: Medium
         Status: Fix Released

** Affects: dash (Ubuntu Trusty)
     Importance: Medium
         Status: Confirmed


** Tags: apport-bug i386 trusty uec-images

** Changed in: dash (Ubuntu)
       Status: New => Fix Released

** Changed in: dash (Ubuntu)
   Importance: Undecided => Medium

** Also affects: dash (Ubuntu Trusty)
   Importance: Undecided
       Status: New

** Changed in: dash (Ubuntu Trusty)
       Status: New => Confirmed

** Changed in: dash (Ubuntu Trusty)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dash in Ubuntu.
https://bugs.launchpad.net/bugs/1689648

Title:
  removing open bracket ([) via ${var#[} does not work.

Status in dash package in Ubuntu:
  Fix Released
Status in dash source package in Trusty:
  Confirmed

Bug description:
  dash in 14.04 has an odd bug in /bin/sh.
     $ var="[abc"
     $ echo "${var#[}"
     [abc

     That *should* output just 'abc' (and does everywhere other than
  14.04).

  It is fairly easily workaroundable by quoting the '[':
     $ var="[abc"
     echo ${var#"["}

  
  To demonstrate:
  $ lxc launch ubuntu-daily:trusty shbug
  $ lxc exec shbug /bin/bash

  % /bin/sh -c 'v=$0; echo ${v#[}' "[abc"
  [abc

  % dpkg -S /bin/sh
  diversion by dash from: /bin/sh
  diversion by dash to: /bin/sh.distrib
  dash: /bin/sh

  % dpkg-query --show dash
  dash  0.5.7-4ubuntu1
  % exit

  ## show that on host, this works as expected.
  $ /bin/sh -c 'v=$0; echo ${v#[}' "[abc"
  abc
  $ dpkg-query --show dash
  dash  0.5.8-2.3ubuntu1

  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: dash 0.5.7-4ubuntu1
  ProcVersionSignature: Ubuntu 4.10.0-20.22-generic 4.10.8
  Uname: Linux 4.10.0-20-generic i686
  ApportVersion: 2.14.1-0ubuntu3.23
  Architecture: i386
  Date: Tue May  9 20:13:57 2017
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   LANG=C.UTF-8
  SourcePackage: dash
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dash/+bug/1689648/+subscriptions



More information about the foundations-bugs mailing list