[Bug 880120] Re: read -r does not protect backslashes
Ian! D. Allen
idallen at idallen.ca
Sun Oct 23 00:19:20 UTC 2011
*** This bug is a duplicate of bug 259671 ***
https://bugs.launchpad.net/bugs/259671
Thanks Jilles - you are absolutely right. I had forgotten about versions of echo that process backslashes.
I see that one cannot turn off the backslash processing of the dash echo, which is why you need the printf.
Thanks!
** Description changed:
+ Edit: This isn't a bug in "read" - it's the way dash's "echo" handles
+ backslashes.
+
Both natty and oneiric dash fail to protect backslashes when using "read
-r".
natty: dash 0.5.5.1-7.2ubuntu1
oneiric: dash 0.5.5.1-7.4ubuntu1
Example bug:
- $ echo '000\n999' | dash -c ' read -r f ; echo "$f" '
- 000
- 999
+ $ echo '000\n999' | dash -c ' read -r f ; echo "$f" '
+ 000
+ 999
Other shells do it correctly:
- $ echo '000\n999' | bash -c ' read -r f ; echo "$f" '
- 000\n999
+ $ echo '000\n999' | bash -c ' read -r f ; echo "$f" '
+ 000\n999
- $ echo '000\n999' | static-sh -c ' read -r f ; echo "$f" '
- 000\n999
+ $ echo '000\n999' | static-sh -c ' read -r f ; echo "$f" '
+ 000\n999
This means you can't use "read" to read arbitrary lines of text.
ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: dash 0.5.5.1-7.2ubuntu1
ProcVersionSignature: Ubuntu 2.6.38-12.51-generic 2.6.38.8
Uname: Linux 2.6.38-12-generic x86_64
Architecture: amd64
Date: Sat Oct 22 18:28:32 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427.1)
SourcePackage: dash
UpgradeStatus: No upgrade log present (probably fresh install)
--
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/880120
Title:
read -r does not protect backslashes
Status in “dash” package in Ubuntu:
New
Bug description:
Edit: This isn't a bug in "read" - it's the way dash's "echo" handles
backslashes.
Both natty and oneiric dash fail to protect backslashes when using
"read -r".
natty: dash 0.5.5.1-7.2ubuntu1
oneiric: dash 0.5.5.1-7.4ubuntu1
Example bug:
$ echo '000\n999' | dash -c ' read -r f ; echo "$f" '
000
999
Other shells do it correctly:
$ echo '000\n999' | bash -c ' read -r f ; echo "$f" '
000\n999
$ echo '000\n999' | static-sh -c ' read -r f ; echo "$f" '
000\n999
This means you can't use "read" to read arbitrary lines of text.
ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: dash 0.5.5.1-7.2ubuntu1
ProcVersionSignature: Ubuntu 2.6.38-12.51-generic 2.6.38.8
Uname: Linux 2.6.38-12-generic x86_64
Architecture: amd64
Date: Sat Oct 22 18:28:32 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427.1)
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/880120/+subscriptions
More information about the foundations-bugs
mailing list