• Bug#267020: duplicate load detection broken

    From Alvaro Martinez Echevarria@1:229/2 to All on Fri Aug 20 12:50:10 2004
    From: [email protected]

    Package: hotplug
    Version: 0.0.20040329-14
    Severity: important

    I'm running sid, with a 2.4.26 kernel. It seems like hotplug is not
    loading any UHCI modules, because usb-uhci is listed in
    /etc/hotplug/blacklist, and the duplication detection code in /etc/hotplug/hotplug.functions is getting confused with the dash
    in the module name. So the system starts in a totally screwed up
    state unless you force the loading of uhci or usb-uhci in
    /etc/modules. As you can imagine, that could be a bit of a
    problem if you depend on, say, a USB 1.1 keyboard. Here's a diff
    that fixes the problem:

    ------------------------------------------------------------------------------- --- /etc/hotplug/hotplug.functions.OLD 2004-08-06 09:41:43.000000000 -070
    0
    +++ /etc/hotplug/hotplug.functions 2004-08-20 01:42:24.000000000 -0700
    @@ -143,14 +143,14 @@
    LOADED=false

    # check the $MODULE already seen
    - if echo "$LOADED_DRIVERS" | grep -q "\<$MODULE\>" > /dev/null 2>&1; then
    + if echo "$LOADED_DRIVERS" | grep -q "\<$(echo $MODULE | sed -e 's/-/_/g')\>" > /dev/null 2>&1; then
    # $MODULE is duplicated?
    continue
    fi
    # XXX:
    # Even $LOADED = false, we may not need to try loading it again.
    # or do we need to check $LOADED = true at end of the loop?
    - LOADED_DRIVERS="$LOADED_DRIVERS $MODULE"
    + LOADED_DRIVERS="$LOADED_DRIVERS $(echo $MODULE | sed -e 's/-/_/g')"

    if ! lsmod | grep -q "^$(echo $MODULE|sed -e 's/-/_/g') " > /dev/null 2>&1; then
    if grep -q "^$(echo $MODULE|sed -e 's/[-_]/[-_]/g')\$" $HOTPLUG_DIR/blacklist \
    -------------------------------------------------------------------------------

    The underlying problem is that, in grep's opi