diff mbox series

[v13,5/8] sstatesig.py: fix hash calculation for timestamp

Message ID 20230817124612.1043464-5-p.lobacz@welotec.com
State New
Headers show
Series [v13,1/8] path.py: add support for ACLs and all additional attributes | expand

Commit Message

Piotr Łobacz Aug. 17, 2023, 12:46 p.m. UTC
Passing timestamp as an integer was losing precision, which led
to problems with badly recreated sstate cache.

Passing it as floating point number fixes the issue.

Signed-off-by: Piotr Łobacz <p.lobacz@welotec.com>
---
 meta/lib/oe/sstatesig.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie Aug. 17, 2023, 1:33 p.m. UTC | #1
On Thu, 2023-08-17 at 14:46 +0200, Piotr Łobacz wrote:
> Passing timestamp as an integer was losing precision, which led
> to problems with badly recreated sstate cache.
> 
> Passing it as floating point number fixes the issue.
> 
> Signed-off-by: Piotr Łobacz <p.lobacz@welotec.com>
> ---
>  meta/lib/oe/sstatesig.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
> index 633a0fd450..f7ea3d366c 100644
> --- a/meta/lib/oe/sstatesig.py
> +++ b/meta/lib/oe/sstatesig.py
> @@ -588,7 +588,7 @@ def OEOuthashBasic(path, sigfile, task, d):
>                          raise Exception(msg).with_traceback(e.__traceback__)
>  
>                  if include_timestamps:
> -                    update_hash(" %10d" % s.st_mtime)
> +                    update_hash(" %f" % s.st_mtime)
>  
>                  update_hash(" ")
>                  if stat.S_ISBLK(s.st_mode) or stat.S_ISCHR(s.st_mode):

As mentioned on irc, we likely need to record ACL/XATTR data in this
file as well, else well just have a different set of bugs in future.
Now we've realised the issue we do need to fix it.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index 633a0fd450..f7ea3d366c 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -588,7 +588,7 @@  def OEOuthashBasic(path, sigfile, task, d):
                         raise Exception(msg).with_traceback(e.__traceback__)
 
                 if include_timestamps:
-                    update_hash(" %10d" % s.st_mtime)
+                    update_hash(" %f" % s.st_mtime)
 
                 update_hash(" ")
                 if stat.S_ISBLK(s.st_mode) or stat.S_ISCHR(s.st_mode):