Skip to contentSkip to conversation

module-init-tools and chained aliases

PATCH Andrey Borzenkov 2 participants 2 messages Jun 15, 2003 – Jun 16, 2003

lore
Share & tools
lore
#0 lore raw

Apparently modprobe from module-init-tools 0.9.11a does not support chained aliases like modutils did, i.e.

alias foo bar
alias bar baz

will result in error doing "modprobe foo" instead of loading "baz".

This is a real problem when converting modules.devfs, because customary

alias /dev/tts* /dev/tts
alias /dev/tts serial

simply does not work for accessing /dev/tts/*. modprobe.devfs as shipped with modue-init-tools has exactly the problem in parts.

It is possible to partially work around it by using

install foo /sbin/modprobe bar

consistently instead of alias but it means extra forks every time, besided it breaks parsing for many tools (initscripts or mkinitrd make heavy use of parsing sometimes, at least on Mandrake).

Is the behaviour intentional? Fixing it is just a one line patch and I fail to see why current state would be preferred.

regards

-andrey

modprobe.c 2003-06-15 13:46:25.000000000 +0400 renamed from modprobe.c.orig 2003-06-15 01:32:21.000000000 +0400 +5 -2
@@ -1021,8 +1021,11 @@ static char *read_config(const char *fil
 
                        if (!wildcard || !realname)
                                grammar(cmd, filename, linenum);
-                       else if (fnmatch(wildcard,name,0) == 0)
-                               result = NOFAIL(strdup(realname));
+                       else if (fnmatch(wildcard,name,0) == 0) {
+                               if (result)
+                                       free(result);
+                               name = result = NOFAIL(strdup(realname));
+                       }
                } else if (strcmp(cmd, "include") == 0) {
                        char *newresult, *newfilename;
 
#1 lore raw

In message <[email protected]> you write:

Quoted 7 lines

Apparently modprobe from module-init-tools 0.9.11a does not support chained aliases like modutils did, i.e.

alias foo bar
alias bar baz

will result in error doing "modprobe foo" instead of loading "baz".

Yes, as per the documentation.

Quoted 4 lines

This is a real problem when converting modules.devfs, because customary

alias /dev/tts* /dev/tts
alias /dev/tts serial

generate-modutils.conf will do the right thing here, and unroll the aliases. And the README in module-init-tools says:

4) If you are using devfs, copy modprobe.devfs to /etc

And modprobe.devfs gets it right.

Quoted 2 lines

Is the behaviour intentional? Fixing it is just a one line patch and I fail to see why current state would be preferred.

Your patch only works for forwards references, not backwards references.

There may be convincing arguments to adding support for recursive aliases, but this isn't it.

Sorry,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.