2008-08-20 09:04:18 |
Edward Crichton |
bug |
|
|
added bug |
2008-08-20 10:15:26 |
Edward Crichton |
title |
shell script parsing words with square brackets in quotes |
shell script parsing of strings when there is a square bracket. Missing backslashes |
|
2008-08-20 10:27:05 |
Edward Crichton |
bug |
|
|
assigned to bash |
2008-08-20 10:33:12 |
Edward Crichton |
description |
Backslashes are cobbled up if a string contains an open square bracket.
If you run the shell script:
#!/bin/sh
BACKSLASH='\u'
SQUARE='\u[]'
echo $BACKSLASH
echo $SQUARE
on ubuntu feisty 2.6.20-16, mac os x and solaris 10 the output is:
\u
\u[]
but after upgrading to hardy 2.6.24-19 the output is:
\u
u[]
It seems to be the parsing of the string. This also happens parsing string parameters on the command line. |
Backslashes are cobbled up if a string contains an open square bracket.
If you run the shell script:
#!/bin/sh
BACKSLASH='\u'
SQUARE='\u[]'
echo $BACKSLASH
echo $SQUARE
on ubuntu feisty 2.6.20-16, mac os x and solaris 10 the output is:
\u
\u[]
but after upgrading to hardy 2.6.24-19 the output is:
\u
u[]
It seems to be the parsing of the string. This also happens parsing string parameters on the command line.
/bin/sh is part of the bash package:
dpkg -L bash
...
/bin/sh
...
|
|
2010-01-06 16:30:00 |
Yann Leprince |
bash: status |
New |
Invalid |
|
2010-01-06 16:40:40 |
Yann Leprince |
affects |
bash (Ubuntu) |
dash (Ubuntu) |
|
2010-01-24 17:28:23 |
Yann Leprince |
dash (Ubuntu): status |
New |
Confirmed |
|
2010-04-25 00:38:20 |
Nonconventionally Creative |
description |
Backslashes are cobbled up if a string contains an open square bracket.
If you run the shell script:
#!/bin/sh
BACKSLASH='\u'
SQUARE='\u[]'
echo $BACKSLASH
echo $SQUARE
on ubuntu feisty 2.6.20-16, mac os x and solaris 10 the output is:
\u
\u[]
but after upgrading to hardy 2.6.24-19 the output is:
\u
u[]
It seems to be the parsing of the string. This also happens parsing string parameters on the command line.
/bin/sh is part of the bash package:
dpkg -L bash
...
/bin/sh
...
|
In dash, backslashes are parsed within single quotes, contradicting the man page, as well as the behavior of other common /bin/sh implementations.
(Does POSIX mention anything?)
The following should print 2 backslashes:
echo '\\'
|
|
2010-04-25 00:38:40 |
Nonconventionally Creative |
summary |
shell script parsing of strings when there is a square bracket. Missing backslashes |
dash parses backslashes in single quotes |
|
2010-04-25 00:42:14 |
Nonconventionally Creative |
bug task added |
|
dash (Debian) |
|
2010-04-25 00:51:16 |
Nonconventionally Creative |
description |
In dash, backslashes are parsed within single quotes, contradicting the man page, as well as the behavior of other common /bin/sh implementations.
(Does POSIX mention anything?)
The following should print 2 backslashes:
echo '\\'
|
In dash, backslashes are parsed within single quotes, contradicting POSIX and it's own man page.
POSIX: http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02_02
The following should print 2 backslashes:
echo '\\'
|
|
2010-10-15 15:18:42 |
Jilles Tjoelker |
summary |
dash parses backslashes in single quotes |
dash: echo builtin interprets backslash escape sequences |
|
2010-10-15 15:23:04 |
Jilles Tjoelker |
bug watch added |
|
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550399 |
|
2013-06-07 19:37:12 |
Phillip Susi |
dash (Debian): importance |
Undecided |
Unknown |
|
2013-06-07 19:37:12 |
Phillip Susi |
dash (Debian): status |
New |
Unknown |
|
2013-06-07 19:37:12 |
Phillip Susi |
dash (Debian): remote watch |
|
Debian Bug tracker #550399 |
|
2013-06-08 15:14:52 |
Bug Watch Updater |
dash (Debian): status |
Unknown |
Won't Fix |
|
2013-06-29 20:39:01 |
Richard Hansen |
dash (Ubuntu): status |
Confirmed |
Invalid |
|