grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] grub-core/genmoddep.awk: ensure output is deterministic


From: Alexander Kanavin
Subject: [PATCH 2/3] grub-core/genmoddep.awk: ensure output is deterministic
Date: Thu, 1 Jun 2023 09:38:19 +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>
---
 grub-core/genmoddep.awk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk
index 04c2863e5..247436392 100644
--- a/grub-core/genmoddep.awk
+++ b/grub-core/genmoddep.awk
@@ -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]++
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]