diff mbox series

[scarthgap,2.8,2/2] siggen: Fix rare file-checksum hash issue

Message ID 20241015114515.1331555-3-alban.bedel@aerq.com
State New
Headers show
Series Bug fixes backport | expand

Commit Message

Bedel, Alban Oct. 15, 2024, 11:45 a.m. UTC
From: Richard Purdie <richard.purdie@linuxfoundation.org>

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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/siggen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chen, Qi Dec. 11, 2024, 3:25 a.m. UTC | #1
I wanted to send out a backport patch but I noticed there's already one.
Could we consider cherry-pick this patch to scarthgap?

Regards,
Qi

On 10/15/24 19:45, Alban Bedel via lists.openembedded.org wrote:
> From: Richard Purdie <richard.purdie@linuxfoundation.org>
>
> 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.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>   lib/bb/siggen.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
> index 65ca0811d58b..8642e07f0fa0 100644
> --- a/lib/bb/siggen.py
> +++ b/lib/bb/siggen.py
> @@ -904,7 +904,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
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#16684): https://lists.openembedded.org/g/bitbake-devel/message/16684
> Mute This Topic: https://lists.openembedded.org/mt/109020496/7304865
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [Qi.Chen@eng.windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
index 65ca0811d58b..8642e07f0fa0 100644
--- a/lib/bb/siggen.py
+++ b/lib/bb/siggen.py
@@ -904,7 +904,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