BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001384 [BusyBox] Other minor always 06-07-07 06:37 06-13-07 02:25
Reporter Mischa Jonker View Status public  
Assigned To BusyBox
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0001384: mdev -s does not populate /dev with devices that contain a symlink in /sys/class
Description mdev -s does not populate /dev with devices that contain a symlink in /sys/class: for instance, I have a device /sys/class/graphics/fb0 which is a symlink to ../../devices/platform/vfb.0/fb0. Because lstat is used in mdev.c (i.s.o. stat) this device is not taken into account, and a node is not created in /dev.

However, changing lstat into stat will cause problems, as there are loops of symlinks in sysfs. udev itself solves this by only allowing to recurse 2 levels deep in the /sys/class and /sys/block directories. The proposed patch is in the additional info.
Additional Information --- busybox-1.5.1.orig/util-linux/mdev.c 2007-05-20 18:58:10.000000000 +0200
+++ busybox-1.5.1/util-linux/mdev.c 2007-06-07 13:39:09.000000000 +0200
@@ -198,7 +198,7 @@
 /* Recursive search of /sys/block or /sys/class. path must be a writeable
  * buffer of size PATH_MAX containing the directory string to start at. */

-static void find_dev(char *path)
+static void find_dev(char *path, int level)
 {
        DIR *dir;
        size_t len = strlen(path);
@@ -219,12 +219,14 @@
                // uClibc doesn't fill out entry->d_type reliably. so we use lstat().

                snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name);
- if (!lstat(path, &st) && S_ISDIR(st.st_mode)) find_dev(path);
+ if (!stat(path, &st) && S_ISDIR(st.st_mode) && (level < 2))
+ find_dev(path, level + 1);
                path[len] = 0;

                /* If there's a dev entry, mknod it */
@@ -248,9 +250,9 @@
                bbg.root_major = major(st.st_dev);
                bbg.root_minor = minor(st.st_dev);
                strcpy(temp,"/sys/block");
- find_dev(temp);
+ find_dev(temp, 0);
                strcpy(temp,"/sys/class");
- find_dev(temp);
+ find_dev(temp, 0);

        /* Hotplug */
Attached Files

- Relationships

- Notes
(0002463)
Souf
06-07-07 13:37

Hi,
read this:
http://bugs.busybox.net/view.php?id=1385 [^]

Thanks.
 
(0002479)
vapier
06-13-07 02:25

current svn should work fine now
 

- Issue History
Date Modified Username Field Change
06-07-07 06:37 Mischa Jonker New Issue
06-07-07 06:37 Mischa Jonker Status new => assigned
06-07-07 06:37 Mischa Jonker Assigned To  => BusyBox
06-07-07 13:37 Souf Note Added: 0002463
06-13-07 02:25 vapier Note Added: 0002479
06-13-07 02:25 vapier Status assigned => closed
06-13-07 02:25 vapier Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker