Skip to contentSkip to conversation

udevstart badly broken in udev 031

DISCUSSION Marco d'Itri 4 participants 4 messages Sep 12, 2004 – Sep 14, 2004

lore
Share & tools
lore
#0 lore raw

Starting from udev 031, the %-arguments passed to PROGRAMs are not correct when the new udevstart code is being used.

KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/inputdev.sh %k %n %M %m", RESULT="inputdev", MODE="0664", GROUP="video"

generates this log (just echo $*):

event0 0 13 64
event0 0 13 64
event0 0 13 64

while the correct log (generated using the old shell script instead of udevstart) would be:

event0 0 13 64
event1 1 13 65
event2 2 13 66

Signature · 13 lines
ciao, |
Marco | [7960 fo3oPmJ4T8olk]


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw
Quoted 11 lines · Marco d'Itri

Starting from udev 031, the %-arguments passed to PROGRAMs are not correct when the new udevstart code is being used.

KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/inputdev.sh %k %n %M %m", RESULT="inputdev", MODE="0664", GROUP="video"

generates this log (just echo $*):

event0 0 13 64
event0 0 13 64
event0 0 13 64

Quoted 6 lines

while the correct log (generated using the old shell script instead of udevstart) would be:

event0 0 13 64
event1 1 13 65
event2 2 13 66

Yes, I can simulate this, please try the attached patch. I expect, that it fixes it, cause we better not mangle the parsed config while matching the rules.

Thanks,
Kay

===== namedev.c 1.144 vs edited =====

namedev.c +5 -3
@@ -813,10 +813,12 @@
 
 		/* execute external program */
 		if (dev->program[0] != '\0') {
+			char program[PROGRAM_SIZE];
+
 			dbg("check " FIELD_PROGRAM);
-			apply_format(udev, dev->program, sizeof(dev->program),
-				     class_dev, sysfs_device);
-			if (execute_program(dev->program, udev->program_result, NAME_SIZE) != 0) {
+			strfieldcpy(program, dev->program);
+			apply_format(udev, program, sizeof(program), class_dev, sysfs_device);
+			if (execute_program(program, udev->program_result, NAME_SIZE) != 0) {
 				dbg(FIELD_PROGRAM " returned nonzero");
 				goto try_parent;
 			} else {
#2 lore raw
In reply to Marco d'Itri

Marco & Kay -

Quoted 4 lines · On Monday 13 September 2004 Kay Sievers wrote:
Quoted 2 lines · Marco d'Itri

Starting from udev 031, the %-arguments passed to PROGRAMs are not correct when the new udevstart code is being used.

Yes, I can simulate this, please try the attached patch.

Thanks - that restores proper operation of my CDROM & CDRW rules, which were broken under udev-031.

-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Marco d'Itri
Quoted 15 lines · Kay Sievers
Quoted 14 lines · Marco d'Itri

Starting from udev 031, the %-arguments passed to PROGRAMs are not correct when the new udevstart code is being used.

KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/inputdev.sh %k %n %M %m", RESULT="inputdev", MODE="0664", GROUP="video"

generates this log (just echo $*):

event0 0 13 64
event0 0 13 64
event0 0 13 64

while the correct log (generated using the old shell script instead of udevstart) would be:

Quoted 7 lines
Quoted 3 lines

event0 0 13 64
event1 1 13 65
event2 2 13 66

Yes, I can simulate this, please try the attached patch. I expect, that it fixes it, cause we better not mangle the parsed config while matching the rules.

Thanks, I've applied this and released a 032 version with this fix and 2 others.

greg k-h

-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel