modalias.prov: stricter module aliase/version mangling
* modalias.prov: Replace everyithing that is not "0-9a-zA-Z.:" in a kernel module version with underscores; replace everything that is not "][0-9a-zA-Z.:*_?/-" in a kernel module alias with underscores. Resolves: #2002887 Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
This commit is contained in:
parent
c07c7ceda8
commit
5240efc112
@ -67,16 +67,12 @@ combine_modaliases() {
|
|||||||
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do
|
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do
|
||||||
# | head -n1 because some modules have *two* version tags. *cough*b44*cough*
|
# | head -n1 because some modules have *two* version tags. *cough*b44*cough*
|
||||||
modver=$(/sbin/modinfo -F version "$module"| head -n1)
|
modver=$(/sbin/modinfo -F version "$module"| head -n1)
|
||||||
modver=${modver// /_}
|
modver=${modver//[^0-9a-zA-Z._]/_}
|
||||||
|
|
||||||
# only add version tag if it has a version
|
# only add version tag if it has a version
|
||||||
if [ -n "$modver" ]; then
|
[ -z "$modver" ] || modver=" = $modver"
|
||||||
|
|
||||||
/sbin/modinfo -F alias "$module" \
|
/sbin/modinfo -F alias "$module" \
|
||||||
| sed -nre "s,(.+),modalias(\\1) = $modver,p"
|
| sed -nre "s,[^][0-9a-zA-Z._:*?/-],_,g; s,(.+),modalias(\\1)$modver,p"
|
||||||
else
|
|
||||||
/sbin/modinfo -F alias "$module" \
|
|
||||||
| sed -nre "s,(.+),modalias(\\1),p"
|
|
||||||
fi
|
|
||||||
done \
|
done \
|
||||||
| sort -u \
|
| sort -u \
|
||||||
| combine_modaliases
|
| combine_modaliases
|
||||||
|
Loading…
Reference in New Issue
Block a user