linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix NAME="foo-%c{N}" gets a truncated name
@ 2004-03-03 22:43 Patrick Mansfield
  2004-03-03 22:58 ` Kay Sievers
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Patrick Mansfield @ 2004-03-03 22:43 UTC (permalink / raw)
  To: linux-hotplug

Here is a fix and a new test for the problem Atul hit, where if we have a
NAME based on a result of the form:

	NAME="foo-%c{7}"

udev truncates the name. Without any prefix (the foo- in this example),
the rule was working OK.

=== namedev.c 1.122 vs edited ==--- 1.122/namedev.c	Tue Mar  2 21:00:21 2004
+++ edited/namedev.c	Wed Mar  3 14:16:54 2004
@@ -285,7 +285,7 @@
 					dbg("requested part of result string not found");
 					break;
 				}
-				strnfieldcat(string, udev->program_result + spos, slen+1);
+				strnfieldcat(string, udev->program_result + spos, maxsize);
 				dbg("substitute part of result string '%s'", pos);
 			} else {
 				strnfieldcat(string, udev->program_result, maxsize);
=== test/udev-test.pl 1.40 vs edited ==--- 1.40/test/udev-test.pl	Fri Feb 27 19:36:01 2004
+++ edited/test/udev-test.pl	Wed Mar  3 14:20:05 2004
@@ -262,6 +262,15 @@
 EOF
 	},
 	{
+		desc     => "lots of arguments and characters before %c{N}",
+		subsys   => "block",
+		devpath  => "block/sda/sda3",
+		expected => "my-foo9" ,
+		conf     => <<EOF
+BUS="scsi", PROGRAM="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL="sda3", NAME="my-%c{7}"
+EOF
+	},
+	{
 		desc     => "program result substitution (numbered part of)",
 		subsys   => "block",
 		devpath  => "block/sda/sda3",


-------------------------------------------------------
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] 8+ messages in thread

end of thread, other threads:[~2004-03-04 18:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-03 22:43 [PATCH] fix NAME="foo-%c{N}" gets a truncated name Patrick Mansfield
2004-03-03 22:58 ` Kay Sievers
2004-03-03 23:46 ` Kay Sievers
2004-03-03 23:57 ` Patrick Mansfield
2004-03-04  0:56 ` Greg KH
2004-03-04  0:56 ` Greg KH
2004-03-04  3:09 ` Kay Sievers
2004-03-04 18:57 ` Greg KH

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).