linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 022]: fix multiple symlinks (was: Re: udev-021 mdk RPM)
@ 2004-03-14  9:59 Andrey Borzenkov
  2004-03-14 16:49 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Borzenkov @ 2004-03-14  9:59 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 885 bytes --]

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

[-- Attachment #2: udev022_namedev_symlink_fix.patch --]
[-- Type: text/x-diff, Size: 1167 bytes --]

--- 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:

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 022]: fix multiple symlinks (was: Re: udev-021 mdk RPM)
  2004-03-14  9:59 [PATCH 022]: fix multiple symlinks (was: Re: udev-021 mdk RPM) Andrey Borzenkov
@ 2004-03-14 16:49 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2004-03-14 16:49 UTC (permalink / raw)
  To: linux-hotplug

On Sun, Mar 14, 2004 at 12:59:09PM +0300, Andrey Borzenkov wrote:
> 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 

Right, PROGRAM in a symlink only rule is broken, so we need to do in
the loop. I missed that part, sorry.

Thanks,
Kay


-------------------------------------------------------
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\x1470&alloc_id638&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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-14 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-14  9:59 [PATCH 022]: fix multiple symlinks (was: Re: udev-021 mdk RPM) Andrey Borzenkov
2004-03-14 16:49 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).