blob: e119ce6bee8ee633a30b097d3b1d1d0868736271 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
http://bugs.gentoo.org/149426
keep from blowing up when people have duplicate aliases ... the grep
ends up including new lines and with certain formed comments, hits an
infinite loop ...
for example, the following inputs illustrates the problem:
----------------------------------------------
# Old nvidia support ...
alias char-major-195 NVdriver
alias /dev/nvidiactl char-major-195
alias char-major-195 nvidia
alias /dev/nvidiactl char-major-195
# To enable Side Band Adressing: NVreg_EnableAGPSBA=1
#options nvidia NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1
#options nvidia NVreg_SoftEDIDs=0 NVreg_Mobile=3
----------------------------------------------
alias a b
alias b a
----------------------------------------------
fixes from Martin V�th
--- generate-modprobe.conf
+++ generate-modprobe.conf
@@ -65,19 +65,29 @@
# Resolve (possibly recursive) alias: args filename alias
resolve_alias()
{
- RA_RESOLVE=`grep "^alias[ ][ ]*$2[ ]" -- $1 | awk '{ print $3 }'`
+ if [ 0$3 -gt 99 ]; then
+ echo "Infinite recursion detected; aborting after $3 tries (alias '$2')" 1>&2
+ return 1
+ fi
+
+ _RA_RESOLVE=`grep "^alias[ ][ ]*$2[ ]" -- $1 | awk '{ print $3 }'`
+ RA_RESOLVE=`echo "$_RA_RESOLVE" | head -n 1`
+ if [ x"$_RA_RESOLVE" != x"$RA_RESOLVE" ]; then
+ echo "Invalid dupliate alias found for '$2' (results: `echo $_RA_RESOLVE`)" 1>&2
+ return 1
+ fi
if [ x"$RA_RESOLVE" = x ]; then
echo $2
return
fi
# Recurse.
- (resolve_alias $1 "$RA_RESOLVE")
+ (resolve_alias $1 "$RA_RESOLVE" $(($3 + 1)))
}
# Parse alias: args filename modulename aliasto.
parse_alias()
{
- PA_ALIAS=`resolve_alias $1 $3`
+ PA_ALIAS=`resolve_alias $1 $3` || exit 1
NAME=`echo $2|sed -e 's/\(block\|char\)-major-\([0-9]\+\)$/\1-major-\2-*/'`
echo "alias $NAME $PA_ALIAS"
@@ -180,7 +190,8 @@
parse_options $MODULE `grab_noninstall_options $REST`
INSTALL_OPTIONS=`grab_install_options $REST`
INSTALL_COMMANDS="$INSTALL_COMMANDS $MODULE"
- eval install_$MODNAME=\"/sbin/modprobe $INSTALL_OPTIONS --ignore-install `resolve_alias $MODPROBECONF $MODULE`\"
+ INSTALL_ALIAS=`resolve_alias $MODPROBECONF "$MODULE"` || exit 1
+ eval install_$MODNAME=\"/sbin/modprobe $INSTALL_OPTIONS --ignore-install $INSTALL_ALIAS\"
;;
*)
parse_options $MODULE "$REST"
|