Skip to contentSkip to conversation

sstate.bbclass: adds warnings for the exceptions of os.utime in siginfo

PATCH In review Jose Quaresma 2 participants 5 messages Oct 3, 2021 – Oct 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sstate.bbclass: adds warnings for the exceptions of os.utime in siginfo

When we can't update the access and modified times of sstate siginfo it is useful to infor the user about that.

---
 meta/classes/sstate.bbclass | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
meta/classes/sstate.bbclass +10 -2
index 92a73114bb..2deecd8777 100644
@@ -720,11 +720,15 @@ def sstate_package(ss, d):
         try:
             os.utime(siginfo, None)
         except PermissionError:
+            bb.warn("Cannot sets the access and modified times of sstate siginfo %s, no access rights" % siginfo)
             pass
         except OSError as e:
             # Handle read-only file systems gracefully
             import errno
-            if e.errno != errno.EROFS:
+            if e.errno == errno.EROFS:
+                bb.warn("Cannot sets the access and modified times of sstate siginfo %s, read-only file system" % siginfo)
+                pass
+            else:
                 raise e
 
     return
@@ -1165,11 +1169,15 @@ python sstate_eventhandler() {
             try:
                 os.utime(siginfo, None)
             except PermissionError:
+                bb.warn("Cannot sets the access and modified times of sstate siginfo %s, no access rights" % siginfo)
                 pass
             except OSError as e:
                 # Handle read-only file systems gracefully
                 import errno
-                if e.errno != errno.EROFS:
+                if e.errno == errno.EROFS:
+                    bb.warn("Cannot sets the access and modified times of sstate siginfo %s, read-only file system" % siginfo)
+                    pass
+                else:
                     raise e
 
 }
Signature · 1 line
2.33.0
#1 lore raw
Quoted 36 lines · Jose Quaresma

When we can't update the access and modified times of sstate siginfo it is useful to infor the user about that.

---
 meta/classes/sstate.bbclass | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
meta/classes/sstate.bbclass +6 -1
index 92a73114bb..2deecd8777 100644
@@ -720,11 +720,15 @@ def sstate_package(ss, d):
         try:
             os.utime(siginfo, None)
         except PermissionError:
+            bb.warn("Cannot sets the access and modified times of sstate siginfo %s, no access rights" % siginfo)
             pass
         except OSError as e:
             # Handle read-only file systems gracefully
             import errno
-            if e.errno != errno.EROFS:
+            if e.errno == errno.EROFS:
+                bb.warn("Cannot sets the access and modified times of sstate siginfo %s, read-only file system" % siginfo)
+                pass
+            else:
                 raise e
 
     return
@@ -1165,11 +1169,15 @@ python sstate_eventhandler() {
             try:
                 os.utime(siginfo, None)
             except PermissionError:
+                bb.warn("Cannot sets the access and modified times of sstate siginfo %s, no access rights" % siginfo)
                 pass
             except OSError as e:

meta/classes/sstate.bbclass python sstate_eventhandler() { · line 1183

Quoted 10 lines
meta/classes/sstate.bbclass +4 -1
                 # Handle read-only file systems gracefully
                 import errno
-                if e.errno != errno.EROFS:
+                if e.errno == errno.EROFS:
+                    bb.warn("Cannot sets the access and modified times of sstate siginfo %s, read-only file system" % siginfo)
+                    pass
+                else:
                     raise e
 
 

I'm not sure we can do this as there are some cases where this is unavoidable by people's state setups and we wouldn't want to show warnings in those cases.

(e.g. think of a shared sstate dir between multiple users where the objects remain owned by the user that created them).

Cheers,

Richard

#2 lore raw

Richard Purdie <[email protected]> escreveu no dia segunda, 4/10/2021 à(s) 15:11:

Quoted 56 lines · Jose Quaresma
Quoted 13 lines

When we can't update the access and modified times of sstate siginfo it is useful to infor the user about that.

---
 meta/classes/sstate.bbclass | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
meta/classes/sstate.bbclass +0 -0
index 92a73114bb..2deecd8777 100644

meta/classes/sstate.bbclass def sstate_package(ss, d): · line 723

Quoted 4 lines
meta/classes/sstate.bbclass +1 -0
@@ -720,11 +720,15 @@ def sstate_package(ss, d):
         try:
             os.utime(siginfo, None)
         except PermissionError:
+            bb.warn("Cannot sets the access and modified times of

sstate siginfo %s, no access rights" % siginfo)

meta/classes/sstate.bbclass def sstate_package(ss, d):

Quoted 7 lines
meta/classes/sstate.bbclass +2 -1
             pass
         except OSError as e:
             # Handle read-only file systems gracefully
             import errno
-            if e.errno != errno.EROFS:
+            if e.errno == errno.EROFS:
+                bb.warn("Cannot sets the access and modified times of

sstate siginfo %s, read-only file system" % siginfo)

meta/classes/sstate.bbclass python sstate_eventhandler() { · line 1172

Quoted 10 lines
meta/classes/sstate.bbclass +3 -0
+                pass
+            else:
                 raise e
 
     return
@@ -1165,11 +1169,15 @@ python sstate_eventhandler() {
             try:
                 os.utime(siginfo, None)
             except PermissionError:
+                bb.warn("Cannot sets the access and modified times of

sstate siginfo %s, no access rights" % siginfo)

meta/classes/sstate.bbclass def sstate_package(ss, d):

Quoted 7 lines
meta/classes/sstate.bbclass +2 -1
                 pass
             except OSError as e:
                 # Handle read-only file systems gracefully
                 import errno
-                if e.errno != errno.EROFS:
+                if e.errno == errno.EROFS:
+                    bb.warn("Cannot sets the access and modified times

of sstate siginfo %s, read-only file system" % siginfo)

meta/classes/sstate.bbclass def sstate_package(ss, d):

Quoted 5 lines
meta/classes/sstate.bbclass +2 -0
+                    pass
+                else:
                     raise e
 
 

I'm not sure we can do this as there are some cases where this is unavoidable by
people's state setups and we wouldn't want to show warnings in those cases.

Quoted 10 lines

(e.g. think of a shared sstate dir between multiple users where the objects remain owned by the user that created them).

Cheers,

Richard

Hi Richard,

I understand the exception for the use cases but I think it would be useful to show this to the users. Will it be more appropriate perhaps to log this as debug messages?

I have a final question that I don't understand clearly.
Can the omission of these timestamps updates on siginfo invalidate the use of the sstate-cache for that task,
bitbake-dumpsig can complain about that?

Signature · 3 lines
Best regards,

José Quaresma
#3 lore raw
Quoted 3 lines · Jose Quaresma

I understand the exception for the use cases but I think it would be useful to show this to the users. Will it be more appropriate perhaps to log this as debug messages?

The trouble is in the situations that is guarding against, the user cannot do anything about it so warnings definitely aren't appropriate and I'm not sure debug messages would be welcome either. Those would be less invasive though.

Quoted 4 lines

I have a final question that I don't understand clearly.
Can the omission of these timestamps updates on siginfo invalidate the use of the sstate-cache for that task,
bitbake-dumpsig can complain about that?

I think there is a misunderstanding here. The timestamps I've been talking about are part of reproducible builds and the SOURCE_DATE_EPOCH variable and code. These aim to make the output identical. If the output is identical, hash equivalence is more successful and the more successful hash equivalence is, the more sstate reuse you get.

The timestamps in this part of the sstate code are simply there to handle sstate artefact aging (e.g. delete things which haven't been used in X weeks). The timestamp change is therefore "nice" but if it doesn't happen, it isn't a problem. Hope that helps clarify.

Cheers,

Richard

#4 lore raw

Richard Purdie <[email protected]> escreveu no dia segunda, 4/10/2021 à(s) 21:03:

Quoted 5 lines · Jose Quaresma
Quoted 1 line

I understand the exception for the use cases but I think it would be

useful

Quoted 1 line

to show this to the users. Will it be more appropriate perhaps to log

this as

Quoted 9 lines
Quoted 1 line

debug messages?

The trouble is in the situations that is guarding against, the user cannot do
anything about it so warnings definitely aren't appropriate and I'm not sure
debug messages would be welcome either. Those would be less invasive though.

After your explanation, it is not so useful.

Quoted 16 lines
Quoted 2 lines

I have a final question that I don't understand clearly. Can the omission of these timestamps updates on siginfo invalidate the

use of

Quoted 2 lines

the sstate-cache for that task,
bitbake-dumpsig can complain about that?

I think there is a misunderstanding here. The timestamps I've been talking about
are part of reproducible builds and the SOURCE_DATE_EPOCH variable and code.
These aim to make the output identical. If the output is identical, hash equivalence is more successful and the more successful hash equivalence is, the
more sstate reuse you get.

Quoted 6 lines

The timestamps in this part of the sstate code are simply there to handle sstate
artefact aging (e.g. delete things which haven't been used in X weeks). The timestamp change is therefore "nice" but if it doesn't happen, it isn't a problem. Hope that helps clarify.

Yes, it is true I have misunderstood that part of the reproducible builds and SOURCE_DATE_EPOCH.
It's hard for me to figure out all the pieces involved in hash equivalence and sstate handling.
One more detail that I understand better.
Your opinions and explanations always help a lot.

Thank you very much.

Quoted 6 lines

Cheers,

Richard

Signature · 3 lines
Best regards,

José Quaresma