Your message dated Wed, 28 Jun 2006 21:32:41 +0200 with message-id <[EMAIL PROTECTED]> and subject line Bug#373772: libsysfs2: sysfs_path_is_link() doesn't report correct answers has caused the attached Bug report to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) Debian bug tracking system administrator (administrator, Debian Bugs database)
--- Begin Message ---Package: libsysfs2 Version: 2.0.0-7 Severity: normal Hi, on my system, this code: #include <sysfs/libsysfs.h> #include <stdio.h> int main(void){ struct dlist *sf_dev_list; struct sysfs_class_device *sf_dev; sf_dev_list = sysfs_get_class_devices(sysfs_open_class("input")); dlist_for_each_data(sf_dev_list, sf_dev, struct sysfs_class_device) { printf("name: %s\npath: %s\n", sf_dev->name, sf_dev->path); if(sysfs_path_is_link(sf_dev->path)) printf("link!\n"); sysfs_close_class_device(sf_dev); } } produces this output: name: event0 path: /sys/class/input/input0/event0 link! name: event1 path: /sys/class/input/input1/event1 link! name: event2 path: /sys/class/input/input2/event2 link! name: event3 path: /sys/class/input/input3/event3 link! name: event4 path: /sys/class/input/input4/event4 link! name: input0 path: /sys/class/input/input0 link! name: input1 path: /sys/class/input/input1 link! name: input2 path: /sys/class/input/input2 link! name: input3 path: /sys/class/input/input3 link! name: input4 path: /sys/class/input/input4 link! name: mice path: /sys/class/input/mice link! name: mouse0 path: /sys/class/input/input0/mouse0 link! name: mouse1 path: /sys/class/input/input3/mouse1 link! while the answer is correct for event[1-4] and mouse[0-1] it isn't for input[0-4], or I'm missing something: total 0 drwxr-xr-x 8 root root 0 2006-06-13 15:27 . drwxr-xr-x 25 root root 0 2006-06-13 10:00 .. lrwxrwxrwx 1 root root 0 2006-06-13 15:27 event0 -> ../../class/input/input0/event0 lrwxrwxrwx 1 root root 0 2006-06-13 15:27 event1 -> ../../class/input/input1/event1 lrwxrwxrwx 1 root root 0 2006-06-13 15:27 event2 -> ../../class/input/input2/event2 lrwxrwxrwx 1 root root 0 2006-06-13 15:27 event3 -> ../../class/input/input3/event3 lrwxrwxrwx 1 root root 0 2006-06-13 15:27 event4 -> ../../class/input/input4/event4 drwxr-xr-x 6 root root 0 2006-06-13 14:26 input0 drwxr-xr-x 5 root root 0 2006-06-13 10:00 input1 drwxr-xr-x 5 root root 0 2006-06-13 10:00 input2 drwxr-xr-x 6 root root 0 2006-06-13 10:00 input3 drwxr-xr-x 5 root root 0 2006-06-13 10:00 input4 drwxr-xr-x 2 root root 0 2006-06-13 10:00 mice lrwxrwxrwx 1 root root 0 2006-06-13 15:27 mouse0 -> ../../class/input/input0/mouse0 lrwxrwxrwx 1 root root 0 2006-06-13 15:27 mouse1 -> ../../class/input/input3/mouse1 thanks in advance, filippo -- System Information: Debian Release: testing/unstable APT prefers experimental APT policy: (650, 'experimental'), (600, 'unstable') Architecture: powerpc (ppc) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.16.9 Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1) Versions of packages libsysfs2 depends on: ii libc6 2.3.999.2-3 GNU C Library: Shared libraries libsysfs2 recommends no packages. -- no debconf information
--- End Message ---
--- Begin Message ---Hi Filippo, Filippo Giunchedi [2006-06-13 15:30 +0200]: > on my system, this code: > > > #include <sysfs/libsysfs.h> > #include <stdio.h> > > int main(void){ > struct dlist *sf_dev_list; > struct sysfs_class_device *sf_dev; > > sf_dev_list = sysfs_get_class_devices(sysfs_open_class("input")); > dlist_for_each_data(sf_dev_list, sf_dev, struct sysfs_class_device) { > printf("name: %s\npath: %s\n", sf_dev->name, sf_dev->path); > if(sysfs_path_is_link(sf_dev->path)) printf("link!\n"); ^^^ Here is the bug: the libsysfs functions have Unix semantics, i. e. 0 is success and !0 is error. You should test for == 0 or use !. Then the output will be correct. > name: event0 > path: /sys/class/input/input0/event0 > link! (which is 'no link' after fixing the return value check) > [...] > while the answer is correct for event[1-4] and mouse[0-1] it isn't for > input[0-4], or I'm missing something: > lrwxrwxrwx 1 root root 0 2006-06-13 15:27 event0 -> > ../../class/input/input0/event0 /sys/class/input/input0/event0 is indeed no symlink. /sys/class/input/event0 is (it points to the former). Walking the tree like this already resolves symbolic links in order to avoid duplicates. Martin -- Martin Pitt http://www.piware.de Ubuntu Developer http://www.ubuntu.com Debian Developer http://www.debian.org In a world without walls and fences, who needs Windows and Gates?
signature.asc
Description: Digital signature
--- End Message ---

