Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 5458 - bug in /sbin/rc testing for devfs
Summary: bug in /sbin/rc testing for devfs
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-23 10:12 UTC by Alexander Holler
Modified: 2002-08-07 16:34 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Holler 2002-07-23 10:12:12 UTC
Hi,   
  
there is a bug in /sbin/rc which has cost me some hours wondering about  
many problems loading modules and so on.  
  
The script uses this many time for testing if devfs is mounted:  
   
mymounts="$(cat /proc/filesystems)"  
if [ "${mymounts/devfs//}" = "${mymounts}" ]  
...  
  
Now, what happens if I have usbdevfs but no devfs?  
I leave this as an excercise for the reader. ;))  
  
The solution is to test against ' devfs' (the space is important).  
  
Another solution is to first remove usbdevfs (and other *devfs* if there are  
more than usbdevfs) and than test against devfs.  
  
I haven't find that earlier because I had devfs compiled in, but disabled  
autoumount. And than devfs becomes mounted (I haven't searched why), but  
devfsd was not started.  
  
So I could modprobe anything, always wondering about no difference in my /dev.  
:(  
  
Kind regards,  
  
Alexander
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2002-07-27 11:12:31 UTC
Testing against ' devfs' always fails my side.

        mymounts="$(awk '$2 ~ "devfs" { print $0 }' /proc/filesystems)"
        #is devfs support compiled in?
        if [ -n "${mymounts}" ]

Is IMHO the best solution.
Comment 2 Alexander Holler 2002-07-27 11:22:37 UTC
To my shame I must tell you that I haven't test it. I've just looked at 
/proc/mounts and thought ' devfs' should do it. Here is the output: 
 
rootfs / rootfs rw 0 0 
/dev/root / ext3 rw 0 0 
none /dev devfs rw 0 0 
proc /proc proc rw 0 0 
tmpfs /mnt/.init.d tmpfs rw 0 0 
usbdevfs /proc/bus/usb usbdevfs rw 0 0 
 
I haven't changed my sbin/rc after discovering the bug, because with automount 
it has worked. 
 
Maybe '\ devfs' could do the trick without sed or awk. 
 
Regards, 
 
Alexander 
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2002-07-27 11:41:55 UTC
tried that, '\tdevfs' '\t devfs' and other combinations.  awk works best,
as would cut, but cut is in /usr/bin.
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2002-08-07 16:34:49 UTC
Fix in CVS.