Bug#295618: broken /etc/init.d/devpts.sh script won't work
Package: libc6
Version: 2.2.5-11.8
Severity: Important
(Debian stable, with 2.6 kernel)
/etc/init.d/devpts.sh contains the following:
##
devpts_avail=`grep -qci '[<[:space:]]devpts' /proc/filesystems || true`
devpts_mounted=`grep -qci '/dev/pts' /proc/mounts || true`
devfs_mounted=`grep -qci '[<[:space:]]/dev[>[:space:]].*devfs' /proc/mounts || true`
if [ $devfs_mounted = 0 ] && [ $devpts_avail != 0 ]
then
##
However, surely this is wrong, as `` backticks are used for recording
the stdout of the command, not the return value. because grep -q || true
doesn't print anything, this variable is assigned an empty string.
bash then complains with "[: =: unary operator expected" because it tries
to do
if [ = 0 ]
which is a syntax error. The end result is my devpts isn't mounted and
I can't run programs that want a pts like screen.
Furthermore, adding || true to each of those tests seems to make the
tests redundant, since ` anything || true ` will return 0 (true).
I think you probably want something like
grep -qci '[<[:space:]]devpts' /proc/filesystems
devpts_avail=$?
(etc)
John McPherson
Reply to: