From: kay.sievers@vrfy.org Date: Tue, 14 Sep 2004 13:50:28 +0000 (-0700) Subject: [PATCH] fix udevstart badly broken in udev 031 X-Git-Tag: 032~3 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=29a3cead404d2043a7a3f98d1fb9c7139222b0df;p=elogind.git [PATCH] fix udevstart badly broken in udev 031 On Mon, 2004-09-13 at 01:56 +0200, Marco d'Itri wrote: > 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 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. --- diff --git a/namedev.c b/namedev.c index 466016c29..e86f88f43 100644 --- a/namedev.c +++ b/namedev.c @@ -813,10 +813,12 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas /* 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 {