From: Pavel Troller Date: Mon, 10 Dec 2007 10:03:46 +0000 Subject: UDEV: A question about %c, RUN+= Message-Id: <20071210100346.GA9982@tangens.sinus.cz> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Hi! I would like to ask, whether the following is an intentional behaviour or a bug: Let's have two rules: KERNEL="sd?", ACTION="remove", PROGRAM="find_dev_from_part.sh %r %k flash", RESULT="flash*", RUN+="/bin/rm %r/%c" KERNEL="sd?", ACTION="remove", PROGRAM="find_dev_from_part.sh %r %k card", RESULT="card*", RUN+="/bin/rm %r/%c" These rules try to find a symlink of a sd* node, which can be either flash* or card*, and remove it when the node is removed. The find_dev_from_part.sh script finds possible link using a "base" name and returns its name in stdout. If the link is not found, stdout is empty. The following RESULT= test checks, whether the result is OK. When exactly this ruleset is applied, and, say, sdc is removed, which has a link as flash0, the FIRST rule RUN command is applied, but it tries to rm /dev/ . I've found, that the %c value for the RUN command is taken from the SECOND rule, where it was empty, because the link is named flash0, not card0. So, a RUN command is run from the first rule, taking %c from the second one, which doesn't work. I solved this problem by enterning an ENV{} variable different for each rule and assigning %c to it immediately after the PROGRAM evaluates and using it in the RUN command It helps. But I feel this behaviour as buggy. All this was tested with udev-117. Any explanation would be greatly appreciated. Please cc: to me, as I'm not a regular member of the list. With regards, Pavel Troller ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ 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