summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-01-26 04:38:33 +0100
committerKay Sievers <kay.sievers@suse.de>2006-01-26 04:38:33 +0100
commit36af2ddcb92c51acad0f909bb5dfb090cea9c5ed (patch)
treee03c315d43e1c73fb9330a231c2ba5fd9f186d42
parentd2f605c8d61e4c5ef129f93510ab8b38e32cee97 (diff)
don't add $SUBSYSTEM automatically as $1 to programs
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
-rw-r--r--RELEASE-NOTES12
-rwxr-xr-xtest/udev-test.pl9
-rw-r--r--udev_utils_run.c12
3 files changed, 18 insertions, 15 deletions
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index d04dcd83be..42048cce53 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -1,3 +1,15 @@
+udev 083
+========
+Fix a bug where NAME="" would prevent RUN from beeing executed.
+
+RUN="/bin/program" does no longer automatically add the subsystem
+as the first parameter. This is from the days of /sbin/hotplug
+which is dead now and it's just confusing to need to add space at the
+end of the program name to prevent this. If you use rules that
+depend on this, like the old "udev_run_hotlugd" and "udev_run_devd",
+switch them to: RUN+="/bin/program $env{SUBSYSTEM}", otherwise
+they will no longer work as expected.
+
udev 082
========
The udev man page has moced to udev(7) as it doesnot describe a command
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 555d36e7f2..b44bd18af5 100755
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -301,15 +301,6 @@ BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-*", NAME="
EOF
},
{
- desc => "program result substitution (no argument should be subsystem)",
- subsys => "block",
- devpath => "/block/sda/sda3",
- exp_name => "subsys_block" ,
- rules => <<EOF
-BUS=="scsi", PROGRAM=="/bin/echo", RESULT=="block", NAME="subsys_block"
-EOF
- },
- {
desc => "program result substitution (newline removal)",
subsys => "block",
devpath => "/block/sda/sda3",
diff --git a/udev_utils_run.c b/udev_utils_run.c
index 31363588c8..76a704c52c 100644
--- a/udev_utils_run.c
+++ b/udev_utils_run.c
@@ -84,16 +84,18 @@ int run_program(const char *command, const char *subsystem,
int devnull;
int i;
+ /* build argv from comand */
strlcpy(arg, command, sizeof(arg));
i = 0;
- if (strchr(arg, ' ')) {
+ if (strchr(arg, ' ') != NULL) {
char *pos = arg;
+
while (pos != NULL) {
if (pos[0] == '\'') {
/* don't separate if in apostrophes */
pos++;
argv[i] = strsep(&pos, "\'");
- while (pos && pos[0] == ' ')
+ while (pos != NULL && pos[0] == ' ')
pos++;
} else {
argv[i] = strsep(&pos, " ");
@@ -102,13 +104,11 @@ int run_program(const char *command, const char *subsystem,
i++;
}
argv[i] = NULL;
- info("'%s'", command);
} else {
argv[0] = arg;
- argv[1] = (char *) subsystem;
- argv[2] = NULL;
- info("'%s' '%s'", arg, argv[1]);
+ argv[1] = NULL;
}
+ info("'%s'", command);
/* prepare pipes from child to parent */
if (result || log) {