Package: dash Version: 0.5.4-12 Severity: normal
dash's read() builtin seems to read the underlying file 1 char at a time. This doesn't work with some files under /proc, since procfs isn't fully POSIX compliant. With bash it works : $ bash -c 'read MAX < /proc/sys/kernel/pid_max; ec 32768 With dash it only reads the first character : $ dash -c 'read MAX < /proc/sys/kernel/pid_max; ec 3 If we use the cat(1) external program it works : $ dash -c 'MAX=$(cat /proc/sys/kernel/pid_max); echo $MAX' 32768 After a little digging, it only appears on files that contains just an integer value. When asked to read with a non-null offset (*ppos != 0), __do_proc_dointvec() just returns 0 (meaning an EOF) as shown on [1]. [1] http://lxr.linux.no/#linux+v2.6.32/kernel/sysctl.c#L2371 I'm aware that the issue isn't strictly a dash one, since it has the right to read one character at a time. But since fixing procfs to be conforming to POSIX isn't a realistic option, would it be possible to have a workaround that doesn't involve an external tool like cat(1) ? -- System Information: Debian Release: 5.0.5 APT prefers proposed-updates APT policy: (500, 'proposed-updates'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.32-bpo.3-686 (SMP w/1 CPU core) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages dash depends on: ii libc6 2.7-18lenny4 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]

