Package: dash
Version: 0.5.5.1-2.3
Severity: normal

According to the POSIX section on parameter expansion (2.6.2):

# The format for parameter expansion is as follows:
#   ${expression}
# where expression consists of all characters until the matching '}' .
# Any '}' escaped by a <backslash> or within a quoted string, and
# characters in embedded arithmetic expansions, command substitutions,
# and variable expansions, shall not be examined in determining the
# matching '}' .

However, dash does not always exclude quoted braces from consideration.
The following code should print an empty line, but dash prints " = 3;}":

 $ unset var; echo ${var+"set {$var} = 3;"}

And the following should print "set {foo} = 3;", but dash prints
"set {foo = 3;}":

 $ var=foo; echo ${var+"set {$var} = 3;"}

The } after $var is being treated as the end of the expansion, the " = 3;"
as a following quoted string, and the last } as an unquoted string.  But
since that first } is inside quotes, POSIX says it cannot be the matching },
and everything up to and including the last brace is part of the expansion.

The only other Posix-like sh I tested that had the same problem is
busybox ash (which shares a common ancestry with dash; probably FreeBSD
ash is also affected, or has already fixed this bug).


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-openvz-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dash depends on:
ii  debianutils                   3.2.1      Miscellaneous utilities specific t
ii  dpkg                          1.15.3.1   Debian package management system
ii  libc6                         2.9-23     GNU C Library: Shared libraries

dash recommends no packages.

dash suggests no packages.

-- debconf information:
* dash/sh: true



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to