[^set] is not correct in glob (it's regexp construct). [!set] is.
sed: -n is not necessary. -e too. manpage recommends using -E instead of -r.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
The time to run on tests/* data decreased from 34.517s to 30.201s.
Do not allow combining of any glob meta characters, either in first
or second line.
The code is still buggy, it may attempt to combine
modalias(abc[def]123)
modalias(abc[dXf]123)
into
modalias(abc[d[eX]f]123)
(presumably there won't be any such cases in real modules, but still).
Eliminate "| head -n1" - do it with bash string ops.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
On my machine, out of 2604 modules, this reduces number of
"provides" items by ~800 (to 12689 items).
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This creates a subshell: ... && ( [ -z "$pos" ] || [ $n = $pos ] )
For example, processing ath9k.ko needed ~80 forks here.
Rather expensive.
This should do the same: ... && [ -z "$pos" -o "$n" = "$pos" ]
While at it, explain algorithm in comments.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
While (in this case) their effect is the same,
many more people know that "local" makes variables function-local,
than that "declare" in bash does the same. I didn't know.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* 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>
* modalias.prov: Chnge interpreter from "/bin/sh" to "/bin/bash" because
it uses bashisms; add "-efu" flags to keep things in check; initialise
is_kernel_package variable; check for presence of /sbin/modinfo, sed,
and sort.
(combine_modaliases): Initialise the "variants" and "pos" variables.
Resolves: #2002887
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
* modalias.prov: Add "(\.gz|\.bz2|\.xz)?" to the end of the module path
matching regular expression, use "$@" instead of $*.
Resolves: #1942537Resolves: #2024117
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>