Patch from Yann Morin to fix bug 941, underscores in module aliases.
This commit was genuinely broken at the time (not related to our build system): scripts/config/mkconfigs.c (2005-08-01 - 2006-10-05 arasi) uretilen bbconfigopts.h icine .config satirlarini kacissiz, ham newline'larla gömüyordu - gecerli C degildi, busybox'un kendi bb_mkdep araci bile parse edemiyordu (7d219aab7 ile duzeltildi, mkconfigs shell scripte cevrildi)
No binary (build failed)
—
(log yok)
| @@ -91,7 +91,8 @@ config CONFIG_MODPROBE | |
| module options from the configuration file. See option below. | |
| config CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS | |
| - | bool "Multiple options parsing" |
| + | bool |
| + | prompt "Multiple options parsing" if CONFIG_NITPICK |
| default y | |
| depends on CONFIG_MODPROBE | |
| help | |
| @@ -106,6 +107,16 @@ config CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS | |
| Saying Y here is not a bad idea if you're not that short | |
| on storage capacity. | |
| + | config CONFIG_FEATURE_MODPROBE_FANCY_ALIAS |
| + | bool |
| + | prompt "Fancy alias parsing" if CONFIG_NITPICK |
| + | default y |
| + | depends on CONFIG_MODPROBE && CONFIG_FEATURE_2_6_MODULES |
| + | help |
| + | Say 'y' here to enable parsing of aliases with underscore/dash |
| + | mismatch between module name and file name, along with bus-specific |
| + | aliases (such as pci:... or usb:... aliases). |
| + | |
| comment "Options common to multiple modutils" | |
| depends on CONFIG_INSMOD || CONFIG_RMMOD || CONFIG_MODPROBE || CONFIG_LSMOD | |
| @@ -712,6 +712,37 @@ static int mod_process ( struct mod_list_t *list, int do_insert ) | |
| return (show_only) ? 0 : rc; | |
| } | |
| + | /* |
| + | * Check the matching between a pattern and a module name. |
| + | * We need this as *_* is equivalent to *-*, even in pattern matching. |
| + | */ |
| + | static int check_pattern( const char* pat_src, const char* mod_src ) { |
| + | int ret; |
| + | |
| + | if (ENABLE_FEATURE_MODPROBE_FANCY_ALIAS) { |
| + | char* pat; |
| + | char* mod; |
| + | char* p; |
| + | |
| + | pat = bb_xstrdup (pat_src); |
| + | mod = bb_xstrdup (mod_src); |
| + | |
| + | for (p = pat; (p = strchr(p, '-')); *p++ = '_' ); |
| + | for (p = mod; (p = strchr(p, '-')); *p++ = '_' ); |
| + | |
| + | ret = fnmatch ( pat, mod, 0 ); |
| + | |
| + | if (ENABLE_FEATURE_CLEAN_UP) { |
| + | free (pat); |
| + | free (mod); |
| + | } |
| + | |
| + | return ret; |
| + | } else { |
| + | return fnmatch ( pat_src, mod_src, 0 ); |
| + | } |
| + | } |
| + | |
| /* | |
| * Builds the dependency list (aka stack) of a module. | |
| * head: the highest module in the stack (last to insmod, first to rmmod) | |
| @@ -730,7 +761,7 @@ static void check_dep ( char *mod, struct mod_list_t **head, struct mod_list_t * | |
| * Of course if the name in the dependency rule is a plain string, | |
| * then we consider it a pattern, and matching will still work. */ | |
| for ( dt = depend; dt; dt = dt-> m_next ) { | |
| - | if ( fnmatch ( dt-> m_name, mod, 0 ) == 0) { |
| + | if ( check_pattern ( dt-> m_name, mod ) == 0) { |
| break; | |
| } | |
| } | |
| @@ -746,7 +777,7 @@ static void check_dep ( char *mod, struct mod_list_t **head, struct mod_list_t * | |
| struct dep_t *adt; | |
| for ( adt = depend; adt; adt = adt-> m_next ) { | |
| - | if ( strcmp ( adt-> m_name, dt-> m_deparr [0] ) == 0 ) |
| + | if ( check_pattern ( adt-> m_name, dt-> m_deparr [0] ) == 0 ) |
| break; | |
| } | |
| if ( adt ) { | |