Skip to contentSkip to conversation

Bogus dependencies

PATCH Alexander E. Patrakov 1 participant 1 message May 14, 2004

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines

In hotplug-2004_04_01, usb.rc line 77, we see:

LISTER=which usbmodules

In previous versions, they used type -p usbmodules, but that's a bashism and therefore should not be used in scripts starting with #!/bin/sh

So this is an argument for inclusion of the "which" program into LFS.

The statement above is only partially correct. Let's study the scripts more thoroughly:

[patrakov in ~/hotplug-2004_04_01]$ grep -rn \`which .
./etc/hotplug/hotplug.functions:84: 2.2*|2.3*|2.4*) LISTER=`which
${TYPE}modules` ;;
./etc/hotplug/pci.rc:46: LISTER=which pcimodules
./etc/hotplug/usb.rc:77: LISTER=which usbmodules

The first occurence is not of any interest to us, because we don't support such old kernels.

The second one is relevant to 2.4 code path only and we can't hit it.

The third one is, however, hit, and that's what I originally reported. But let's see if the usbmodules command is actually used. The answer is "no"! Details:

The hotplug package, as one can see from the hotplug.functions file, does not use listers with 2.6 kernels. Therefore, the result of such testing is relevant to 2.4 code path, and the test itself can be moved there, see the attached patch.

Summary: the dependencies of hotplug upon "usbmodules" and "which" with 2.6 kernels are bogus and can be patched out without loss of functionality.

Signature · 1 line
Alexander E. Patrakov

Submitted By: Alexander E. Patrakov
Date: 2004-05-13
Initial Package Version: 2004_04_01
Upstream Status: will send a copy to [email protected]
Origin: Alexander E. Patrakov
Description: Removes bogus dependency upon "which" and "usbmodules" programs in 2.6 code path

etc/hotplug/usb.rc renamed from etc/hotplug/usb.rc.old +6 -6
@@ -73,12 +73,6 @@
 	#
 
 	# synthesize hotplug events if we can 
-	# we need (non-bash) programs to parse descriptors.
-	LISTER=`which usbmodules`
-	if [ "$LISTER" = "" -o ! -f /proc/bus/usb/devices ]; then
-		echo $"** can't synthesize root hub events"
-		return
-	fi
 
 	# make sure the usb agent will run
 	ACTION=add
@@ -113,6 +107,12 @@
 		done
 	    fi
 	else
+    	    # we need (non-bash) programs to parse descriptors.
+	    LISTER=`which usbmodules`
+	    if [ "$LISTER" = "" -o ! -f /proc/bus/usb/devices ]; then
+		echo $"** can't synthesize root hub events"
+		return
+	    fi
 	    for DEVICE in /proc/bus/usb/*/*; do
 		/etc/hotplug/usb.agent
 	    done