[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#295618: broken /etc/init.d/devpts.sh script won't work



tags 295618 woody
thanks

At Thu, 17 Feb 2005 12:52:10 +1300,
John R. McPherson <jrm+libcbug@wlug.org.nz> wrote:
> (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)

Yes, IIRC, this problem was reported and fixed during the development
of the sarge's glibc.  Please check /etc/init.d/mountkernfs file in
the latest sarge.  I tagged it as woody.

Regards,
-- gotom



Reply to: