linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@mail.ru>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH 022]: fix multiple symlinks (was: Re: udev-021 mdk RPM)
Date: Sun, 14 Mar 2004 09:59:09 +0000	[thread overview]
Message-ID: <200403141259.09257.arvidjaar@mail.ru> (raw)

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

             reply	other threads:[~2004-03-14  9:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-14  9:59 Andrey Borzenkov [this message]
2004-03-14 16:49 ` [PATCH 022]: fix multiple symlinks (was: Re: udev-021 mdk RPM) Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200403141259.09257.arvidjaar@mail.ru \
    --to=arvidjaar@mail.ru \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).