Bug#573287: dash: read function does not work as specified in manpage towards backslashes
hi gerrit, mmm... isn't the echo command an external command?... whereis echo echo: /bin/echo /usr/share/man/man1/echo.1.gz /usr/share/man/man3/echo.3ncurses.gz .. should behave the same on different shells, right? i still went and tested your sugestion on my lenny, which gave me also diferent results for bash and dash... #bash: read line printf %s\n $line \\ \\ \\ \\ \ \ \ \ read -r line printf %s\n $line \\ \\ \\ \\ \\ \\ \\ \\ #dash: read line printf %s\n $line \\ \\ \\ \\ read -r line printf %s\n $line \\ \\ \\ \\ \\ \\ \\ \\ if the debian default shell is now dash (afaik) this makes existing scripts unreliable and prone to error... right? best wishes rui On 4 May 2010 17:04, Gerrit Pape p...@smarden.org wrote: On Wed, Mar 10, 2010 at 11:02:15AM +, Rui Damas wrote: the bellow examples explain it: #bash: $ read line echo $line \\ \\ \\ \\ \ \ \ \ $ read -r line echo $line \\ \\ \\ \\ #dash: $ read line echo $line \\ \\ \\ \\ \\ $ read -r line echo $line \\ \\ \ \ Hi Rui, it's the 'echo $line' that recognizes the backslash, not 'read -r', see http://www.opengroup.org/onlinepubs/009695399/utilities/echo.html Please try dash -c 'read -r line printf %s\n $line' \EOT \\ \\ EOT Regards, Gerrit.
Bug#573287: dash: read function does not work as specified in manpage towards backslashes
found 573287 0.5.4-12 notfound 573287 0.5.5.1-4 quit On Wed, May 05, 2010 at 07:58:51AM +0100, -=}*/{=- wrote: mmm... isn't the echo command an external command?... whereis echo echo: /bin/echo /usr/share/man/man1/echo.1.gz /usr/share/man/man3/echo.3ncurses.gz It's both $ bash -c 'type echo' echo is a shell builtin $ dash -c 'type echo' echo is a shell builtin $ which echo /bin/echo $ .. should behave the same on different shells, right? Unfortunately it doesn't, since ages. That's why printf should be used instead in portable scripts. i still went and tested your sugestion on my lenny, which gave me also diferent results for bash and dash... #bash: read line printf %s\n $line \\ \\ \\ \\ \ \ \ \ read -r line printf %s\n $line \\ \\ \\ \\ \\ \\ \\ \\ #dash: read line printf %s\n $line \\ \\ \\ \\ This seems to be a bug that affects dash in Debian/stable. It's fixed in dash available in Debian/testing and unstable. $ dpkg -l dash |grep ^ii ii dash 0.5.5.1-4 POSIX-compliant shell $ dash -c 'read line printf %s\n $line' \EOT \\ \\ \\ \\ EOT \ \ \ \ $ Thanks for reporting this, Gerrit. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#573287: dash: read function does not work as specified in manpage towards backslashes
Package: dash Version: 0.5.5.1-3 Severity: important the bellow examples explain it: #bash: $ read line echo $line \\ \\ \\ \\ \ \ \ \ $ read -r line echo $line \\ \\ \\ \\ #dash: $ read line echo $line \\ \\ \\ \\ \\ $ read -r line echo $line \\ \\ \ \ -- System Information: Debian Release: squeeze/sid APT prefers testing-proposed-updates APT policy: (500, 'testing-proposed-updates'), (500, 'unstable'), (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-2-amd64 (SMP w/1 CPU core) Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Shell: /bin/sh linked to /bin/dash Versions of packages dash depends on: ii debianutils 3.2.2 Miscellaneous utilities specific t ii dpkg 1.15.5.6 Debian package management system ii libc6 2.10.2-6 Embedded GNU C Library: Shared lib dash recommends no packages. dash suggests no packages. -- debconf information: * dash/sh: true -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org