From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Borzenkov Date: Sun, 14 Mar 2004 09:59:09 +0000 Subject: [PATCH 022]: fix multiple symlinks (was: Re: udev-021 mdk RPM) Message-Id: <200403141259.09257.arvidjaar@mail.ru> MIME-Version: 1 Content-Type: multipart/mixed; boundary="Boundary-00=_tzCVAc9zN7+Oorl" List-Id: To: linux-hotplug@vger.kernel.org --Boundary-00=_tzCVAc9zN7+Oorl Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sunday 14 March 2004 00:59, Svetoslav Slavtchev wrote: > > On Saturday 13 March 2004 23:06, Svetoslav Slavtchev wrote: > > > > Svetloslav, are you still interested? > > > > > > yep .-) > > > i actually was working on a bk snapshot from 2-3 days ago > > > but now that 022 is out, i'll update it and upload to > > > http://karlovo.demon.co.uk/~svetlio/cook/2.6/udev/ > > so the bk snapshot works > and the final 022 creates a lot of "*/%n"" , "%c{1}", "%k" > devices :( > This got completely broken. Kay, you cannot apply_format after loop over rules was exited. At this point information is long ago lost. Format is per-rule; there is no place to save information for all rules used. You first add symlink that is using results of program invocation _in_the_same_rule_, then those results are lost and finally you apply some random values. Attached patch fixes it. -andrey --Boundary-00=_tzCVAc9zN7+Oorl Content-Type: text/x-diff; charset="iso-8859-1"; name="udev022_namedev_symlink_fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="udev022_namedev_symlink_fix.patch" --- udev-022/namedev.c.symlink 2004-03-13 02:53:56.000000000 +0300 +++ udev-022/namedev.c 2004-03-14 12:51:40.358667872 +0300 @@ -814,12 +814,21 @@ int namedev_name_device(struct sysfs_cla return -1; } + /* + * We must apply format here; we can't do it after + * loop has exited because information will be lost. + * Format is per-rule not global + */ if (dev->symlink[0] != '\0') { + char temp[NAMESIZE]; + info("configured rule in '%s' at line %i applied, added symlink '%s'", dev->config_file, dev->config_line, dev->symlink); + strfieldcpy(temp, dev->symlink); + apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); if (udev->symlink[0] != '\0') strfieldcat(udev->symlink, " "); - strfieldcat(udev->symlink, dev->symlink); + strfieldcat(udev->symlink, temp); } if (dev->name[0] != '\0') { @@ -837,7 +846,6 @@ int namedev_name_device(struct sysfs_cla found: apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); - apply_format(udev, udev->symlink, sizeof(udev->symlink), class_dev, sysfs_device); udev->partitions = dev->partitions; done: --Boundary-00=_tzCVAc9zN7+Oorl-- ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel