Hotplug needs the "which" program

Alexander E. Patrakov see at the.sig
Thu May 13 08:46:54 PDT 2004


Alexander E. Patrakov wrote without thinking even a bit:
> 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.

P.S. The hotplug functionality is deficient anyway when hcd drivers are
not modules, because usb.rc does not set the DEVICE variable correctly.
And usb.rc is not needed when they are modules, because usb.agent gets
real hotplug events after these modules being found by pci.rc.

-- 
Alexander E. Patrakov
To get my address: echo '0!42!+/6 at 5-3.535.25' | tr [!-:] [a-z] | tr n .
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hotplug-2004_04_01-bogus-deps-1.patch
Type: text/x-patch
Size: 1124 bytes
Desc: not available
URL: <http://lists.linuxfromscratch.org/pipermail/patches/attachments/20040513/714a07d4/attachment.bin>


More information about the patches mailing list