Skip to contentSkip to conversation

siggen: Fix rare file-checksum hash issue

PATCH In review Richard Purdie 3 participants 3 messages Sep 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 siggen: Fix rare file-checksum hash issue

There is a subtle issue with full pathnames being included in the file checksums since the sorting might be different depending upon how layers are being setup causing hash mismatches for recipes appeneded from other layers with differing directory layouts.

Avoid this by filtering out to the path basename which is what is written into the sig data anyway later in the code.

---
 lib/bb/siggen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/siggen.py +1 -1
index 8f24535528..a6163b55ea 100644
@@ -878,7 +878,7 @@ def clean_checksum_file_path(file_checksum_tuple):
     f, cs = file_checksum_tuple
     if "/./" in f:
         return "./" + f.split("/./")[1]
-    return f
+    return os.path.basename(f)
 
 def dump_this_task(outfile, d):
     import bb.parse
#1 lore raw
Quoted 27 lines

-----Original Message-----
From: [email protected] <bitbake- [email protected]> On Behalf Of Richard Purdie
Sent: den 5 september 2024 17:59
To: [email protected]
Subject: [bitbake-devel] [PATCH] siggen: Fix rare file-checksum hash issue

There is a subtle issue with full pathnames being included in the file checksums since the sorting might be different depending upon how layers are being setup causing hash mismatches for recipes appeneded from other layers with differing directory layouts.

Avoid this by filtering out to the path basename which is what is written into the sig data anyway later in the code.

---
 lib/bb/siggen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/siggen.py +0 -0
index 8f24535528..a6163b55ea 100644

lib/bb/siggen.py def clean_checksum_file_path(file_checksum_tuple): · line 880

Quoted 3 lines
lib/bb/siggen.py +0 -0
@@ -878,7 +878,7 @@ def clean_checksum_file_path(file_checksum_tuple):
     f, cs = file_checksum_tuple
     if "/./" in f:
         return "./" + f.split("/./")[1]

Wouldn't it make sense to remove the if-statement above then too?

lib/bb/siggen.py def clean_checksum_file_path(file_checksum_tuple): · line 884

Quoted 5 lines
lib/bb/siggen.py +1 -1
-    return f
+    return os.path.basename(f)
 
 def dump_this_task(outfile, d):
     import bb.parse

//Peter

#2 lore raw
Quoted 23 lines · Peter Kjellerstedt via lists.openembedded.org
Quoted 8 lines

-----Original Message-----
From: [email protected] <bitbake- [email protected]> On Behalf Of Richard Purdie
Sent: den 5 september 2024 17:59
To: [email protected]
Subject: [bitbake-devel] [PATCH] siggen: Fix rare file-checksum hash

issue

Quoted 14 lines

There is a subtle issue with full pathnames being included in the file checksums since the sorting might be different depending upon how layers are being setup causing hash mismatches for recipes appeneded from other layers with differing directory layouts.

Avoid this by filtering out to the path basename which is what is written into the sig data anyway later in the code.

---
 lib/bb/siggen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines

lib/bb/siggen.py def clean_checksum_file_path(file_checksum_tuple): · line 880

Quoted 8 lines
lib/bb/siggen.py +0 -0
index 8f24535528..a6163b55ea 100644
@@ -878,7 +878,7 @@ def clean_checksum_file_path(file_checksum_tuple):
     f, cs = file_checksum_tuple
     if "/./" in f:
         return "./" + f.split("/./")[1]

Wouldn't it make sense to remove the if-statement above then too?

I believe that would break the ability to detect changes to in-tree code.

Refer to the following two commits for background:

https://git.openembedded.org/bitbake/commit/?id=b4975d2ecf615ac4c240808fbc5a3f879a93846b
https://git.openembedded.org/bitbake/commit/?id=5293a1b36eeb89f57577cb709ec7f293909039a1

..Ch:W..

Signature · 2 lines
*"Perfection must be reached by degrees; she requires the slow hand of
time." - Voltaire*