[BusyBox 0000661]: mdev doesn't work with uClibc-0.9.28

bugs at busybox.net bugs at busybox.net
Sat Feb 4 02:17:45 UTC 2006


The following issue has been CLOSED 
====================================================================== 
http://busybox.net/bugs/view.php?id=661 
====================================================================== 
Reported By:                gavinl
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   661
Category:                   Other
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     closed
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             01-26-2006 10:23 PST
Last Modified:              02-03-2006 18:17 PST
====================================================================== 
Summary:                    mdev doesn't work with uClibc-0.9.28
Description: 
1. if read() file return less than 1, we should close the fd and then goto
end.
2. In uClibc-0.9.28, the entry->d_type is always DT_UNKNOWN, so we can't
use d_type to check if it is a directory.
3. We need to omit "device" and "bridge" in searchin /proc directory, they
are links, and will cause endless loop.

Patch based on busybox-1.1.0 and a snapshot is attached.
====================================================================== 

---------------------------------------------------------------------- 
 gavinl - 01-27-06 06:03  
---------------------------------------------------------------------- 
In Description 3, it should be "in searching /sys directory" 

---------------------------------------------------------------------- 
 landley - 01-29-06 01:18  
---------------------------------------------------------------------- 
http://busybox.net/bugs/view.php?id=1 fixed.
http://busybox.net/bugs/view.php?id=2: why isn't this a uClibc bug?
http://busybox.net/bugs/view.php?id=3: This is related to
http://busybox.net/bugs/view.php?id=2: we're only recursing into directories,
not into
symlinks.  This problem only happens when we can't tell the difference,
because the C library is broken.

Now proposed changes to /sys break this by turning everything into
symlinks, but udev keeps breaking so I suppose they feel they must break
mdev to maintain parity. :)  But hardwiring in knowledge about the names
of specific branches it's dangerous do go down is _exteremely_ ugly...

http://lwn.net/Articles/162242/ 

---------------------------------------------------------------------- 
 landley - 01-29-06 01:19  
---------------------------------------------------------------------- 
Wow, this bug generator just manifested yet another unwanted feature,
following a # with a number turns into a link to a bug.  If I wanted to
link to a bug I'd use html markup in my comment... 

---------------------------------------------------------------------- 
 vapier - 02-02-06 16:17  
---------------------------------------------------------------------- 
seems you forgot to commit the fix for (1) ... ive added that myself now

as for (2), i'll look into this for uClibc 

---------------------------------------------------------------------- 
 gavinl - 02-03-06 10:41  
---------------------------------------------------------------------- 
Base on the man 3 readdir,  I don't think 2 if a bug of uClibc. Use of
d_type field will harm  the  portability  of  your  programs. ( Fix me if
I am wrong. I did man 3 readdir in Fedora 3 )

DESCRIPTION
       The  readdir()  function returns a pointer to a dirent structure
repre-
       senting the next directory entry in the directory stream pointed to
 by
       dir.   It  returns  NULL  on  reaching  the  end-of-file or if an
error
       occurred.

       According to POSIX, the dirent structure contains a field char
d_name[]
       of  unspecified  size,  with  at most NAME_MAX characters preceding
the
       terminating null character.  Use of other fields will harm  the 
porta-
       bility  of  your  programs.  POSIX 1003.1-2001 also documents the
field
       ino_t d_ino as an XSI extension.

       The data returned by readdir() may be overwritten by  subsequent 
calls
       to readdir() for the same directory stream. 

---------------------------------------------------------------------- 
 vapier - 02-03-06 10:49  
---------------------------------------------------------------------- 
i saw that as well but i dont think we need to worry about it ... reasons
being:

- mdev only works on Linux and requires linux-2.6.0 or better (/sys)
- the kernel has been exporting d_type information since before
linux-2.6.0 for all Linux ports

also, if we assume d_type works, the code is much smaller than the version
you wrote (even though your version will always work regardless of kernel) 

---------------------------------------------------------------------- 
 landley - 02-03-06 12:36  
---------------------------------------------------------------------- 
I referenced the Linux Weekly News article for a reason.  The layout of
/sys is changing and I want to see what it changes to in order to make the
mdev changes.

The patch to actually make the userspace change was submitted Jan 27, and
LWN linked to it as http://lwn.net/Articles/169754/

I also have email from Greg Kroah-Hartman with the relevant scanning
section from the current udev cvs, which I need to analyze this weekend
and see what the smallest way to make it work is.  Tomorrow is saturday, I
get to poke at this for a bit... 

---------------------------------------------------------------------- 
 vapier - 02-03-06 18:17  
---------------------------------------------------------------------- 
ok, ive fixed getdents in uClibc svn to properly export the d_type field
... that should cover everything here 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
01-26-06 10:23  gavinl         New Issue                                    
01-26-06 10:23  gavinl         Status                   new => assigned     
01-26-06 10:23  gavinl         Assigned To               => BusyBox         
01-26-06 10:23  gavinl         File Added: busybox-1.1.0-mdev.patch             
      
01-27-06 06:03  gavinl         Note Added: 0001014                          
01-29-06 01:18  landley        Note Added: 0001018                          
01-29-06 01:19  landley        Note Added: 0001019                          
02-02-06 16:17  vapier         Note Added: 0001028                          
02-03-06 10:41  gavinl         Note Added: 0001029                          
02-03-06 10:49  vapier         Note Added: 0001030                          
02-03-06 12:36  landley        Note Added: 0001031                          
02-03-06 18:17  vapier         Note Added: 0001032                          
02-03-06 18:17  vapier         Status                   assigned => closed  
02-03-06 18:17  vapier         Resolution               open => fixed       
======================================================================




More information about the busybox-cvs mailing list