]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
grub-core/genmoddep.awk: Ensure output is deterministic
authorAlexander Kanavin <alex.kanavin@gmail.com>
Thu, 1 Jun 2023 07:38:19 +0000 (09:38 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 13 Jun 2023 12:12:07 +0000 (14:12 +0200)
The output in moddep.lst generated from syminfo.lst using genmoddep.awk
is not deterministic since the order of the dependencies on each line
can vary depending on how awk sorts the values in the array.

Be deterministic in the output by sorting the dependencies on each line.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/genmoddep.awk

index 04c2863e5abfa4d950df2c41d579dea03a361927..247436392134f1f0bb4ef679f6f4611ec51776fa 100644 (file)
@@ -59,7 +59,9 @@ END {
     }
     modlist = ""
     depcount[mod] = 0
-    for (depmod in uniqmods) {
+    n = asorti(uniqmods, w)
+    for (i = 1; i <= n; i++) {
+      depmod = w[i]
       modlist = modlist " " depmod;
       inverse_dependencies[depmod] = inverse_dependencies[depmod] " " mod
       depcount[mod]++