Skip to contentSkip to conversation

hotplug.functions load_drivers() error

DISCUSSION Ian Abbott 2 participants 2 messages Jun 6, 2003

lore
Share & tools
lore

Ian Abbott

author
#0 lore raw

Dear all,

There is a bug in the load_drivers() function in hotplug.functions. On my machine it manifests as a bunch of messages on the console such as:

/etc/hotplug/pci.agent: line 167: [: =: unary operator expected
...
/etc/hotplug/usb.agent: line 167: [: =: unary operator expected
...

See
<http://sourceforge.net/tracker/index.php?funcÞtail&aids5123&group_id679&atid7679>.

The problem is that $LOADED is conditionally set each time around the "for $MODULE in $DRIVERS" loop, but unconditionally tested, so $LOADED could be null or whatever it was in the previous iteration.

Is the correct fix to move the "LOADEDúlse" line to the top of the loop, or is there more to than that?

--- etc/hotplug/hotplug.functions.orig 2003-04-15 17:38:42.000000000 +0100
+++ etc/hotplug/hotplug.functions 2003-06-06
14:16:47.000000000 +0100
@@ -131,13 +131,13 @@
for MODULE in $DRIVERS
do
# maybe driver modules need loading
+ LOADEDúlse

        if ! lsmod | grep -q "^$MODULE " > /dev/null 2>&1; then
            if grep -q "^$MODULE\$" $HOTPLUG_DIR/blacklist \
                    >/dev/null 2>&1; then
                debug_mesg "... blacklisted module:  $MODULE"
                continue
            fi

- LOADEDúlse

            # statically linked modules aren't shown by 'lsmod',
            # and user mode drivers will ONLY have a setup script;

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
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 7 lines · Ian Abbott

The problem is that $LOADED is conditionally set each time around the "for $MODULE in $DRIVERS" loop, but unconditionally tested, so $LOADED could be null or whatever it was in the previous iteration.

Is the correct fix to move the "LOADEDúlse" line to the top of the loop, or is there more to than that?

That looks right to me. Merged -- thanks!

- Dave

p.s. Olaf, your updates to this file are now in too.

-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel