[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#350915: udev: Doesn't load usb-storage when I plug in a camera



reassign 350915 module-init-tools
thanks

Marco d'Itri wrote:
>>>> MODALIAS=usb:v054Cp0010d0410dc00dsc00dp00ic08iscFFip01
>> Thanks for the quick reply--but does this line in modules.alias not
>> match the MODALIAS string?
>>
>>  alias usb:v054Cp0010d04[0-4]*dc*dsc*dp*ic*isc*ip* usb_storage
> I don't know. If they should match then either the alias or the
> $MODALIAS string are wrong, and the kernel is buggy, or they are
> correct, and modprobe is buggy.

Ok, it's a bug in module-init-tools. The 'underscores' function mangles
bracket glob expressions:

$ grep 'fnmatch("usb:v054Cp0010d04' ltrace.out
fnmatch("usb:v054Cp0010d04[0_4]*dc*dsc*dp*ic*isc*ip*",
"usb:v054Cp0010d0410dc00dsc00dp00ic08iscFFip01", 0) = 1

"[0-4]" is mangled into "[0_4]". Here's a quick fix:

---
module-init-tools-3.2.2/build-tree/module-init-tools-3.2.2/modprobe.c
   2006-02-02 18:53:44.000000000 +0000
+++
module-init-tools-3.2.2+sam/build-tree/module-init-tools-3.2.2/modprobe.c
 2006-02-02 20:06:58.000000000 +0000
@@ -996,10 +996,17 @@
 static char *underscores(char *string)
 {
        if (string) {
+               int inbracket = 0;
                unsigned int i;
                for (i = 0; string[i]; i++)
-                       if (string[i] == '-')
+                       if (string[i] == '[')
+                               inbracket = 1;
+                       else if (string[i] == ']')
+                               inbracket = 0;
+                       else if (string[i] == '-' && !inbracket)
                                string[i] = '_';
+               if (inbracket)
+                       warn("Unmatched bracket in %s\n", string);
        }
        return string;
 }

That seems to work fine as long as you don't want to have modules or
aliases with actual bracket characters in their names, or bracket glob
expressions containing bracket characters, and so on.

-- 
Sam Morris
http://robots.org.uk/

PGP key id 5EA01078
3412 EA18 1277 354B 991B  C869 B219 7FDB 5EA0 1078



Reply to: