On Sun, Apr 18, 2010 at 08:27:44PM +0200, Marco d'Itri wrote:
> On Apr 18, Mario 'BitKoenig' Holbe <mario.ho...@tu-ilmenau.de> wrote:
> > KERNEL=="audio",                NAME="%k0",             SYMLINK+="%k"
> Nowadays this is considered bad, accordingly to the upstream maintainer
> you should not change the kernel name of a device.

$ grep -rl 'NAME=[^=]' /etc/udev/rules.d /lib/udev/rules.d
/etc/udev/rules.d/70-persistent-net.rules
/etc/udev/rules.d/00-local.rules
/lib/udev/rules.d/75-persistent-net-generator.rules
/lib/udev/rules.d/55-dm.rules
/lib/udev/rules.d/50-udev-default.rules

Apart from my own rules this seems to be quite a common behaviour.

> I expect that if you swap NAME and SYMLINK it would work again.

Yes, but this is a) not what I want and b) not what this bug is about :)
See below for further arguments regarding a).

> I uploaded to http://www.bofh.it/~md/debian/ a *TOTALLY UNTESTED*
> package of a current GIT snapshot: there have been some upstream changes
> related to this

No change regarding this issue. The symlink is still removed shortly
after being created.

diff udev-146~udev-event.c udev-152~git~udev-event.c
+                       /* remove kernel-created node, if needed */
+                       if (udev_device_get_knodename(dev) != NULL && 
strcmp(event->name, udev_device_get_knodename(dev)) != 0) {
+                               struct stat stats;
+                               char filename[UTIL_PATH_SIZE];
+
+                               util_strscpyl(filename, sizeof(filename), 
udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL);
+                               if (stat(filename, &stats) == 0 && 
stats.st_rdev == udev_device_get_devnum(dev)) {
+                                       info(event->udev, "remove kernel 
created node '%s'\n", udev_device_get_knodename(dev));
+                                       util_unlink_secure(event->udev, 
filename);
+                                       util_delete_path(event->udev, filename);
+                               }
+                       }

Probably, using lstat() instead of stat() here would fix this specific
problem, but I'm not sure if this is (or should be) really the right way
to fix this.

> but I am not even sure that this would be accepted as a
> bug.

Well, I think moving device nodes forth and back in the /dev tree is
quite common behaviour - let it be users or applications who like to
group device nodes in subdirectories (devfs-style, for example), let it
be device-mapper (lvm, dmsetup, cryptsetup) who likes to rename device
nodes to more verbose names, let it be network devices which fortunately
or unfortunately have no device-node representation (yet), let it be
something else.

Replacing the original device node with a symlink is then just a usual
consequence because some applications appear to depend on specific names
(whether this makes sense or not).

> > Btw. from what I have seen in the changelogs, I second Bastians
> > assumption about the reason for the missing symlinks.
> I think I missed it, what would that be?

Hmmmm, sorry my fault. I somehow remember about an assumption that the
removed symlinks had to do with some reorganized/simplified node
handling. I thought Bastian did assume this originally but this doesn't
seem to be the case.


regards
   Mario
-- 
Programmieren in C++ haelt die grauen Zellen am Leben. Es schaerft
alle fuenf Sinne: den Schwachsinn, den Bloedsinn, den Wahnsinn, den
Unsinn und den Stumpfsinn.
                                 [Holger Veit in doc]

Attachment: signature.asc
Description: Digital signature

Reply via email to