Skip to contentSkip to conversation

lib/sstatesig/find_siginfo: raise an error instead of returning None when obtaining mtime

PATCH In review Alexander Kanavin 2 participants 3 messages Jan 2, 2024 – Jan 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/sstatesig/find_siginfo: raise an error instead of returning None when obtaining mtime

Suppressing the error and returning None can result in a delayed failure:
https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/6254/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6262/steps/14/logs/stdio

It is not clear why the os.stat() error occurs to begin with (it shouldn't), so rather than adding further workarounds, let's get diagnostics at the source first, so we understand what is going on.

---
 meta/lib/oe/sstatesig.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta/lib/oe/sstatesig.py +1 -4
index 0342bcdc87a..6f124e4f59b 100644
@@ -357,10 +357,7 @@ def find_siginfo(pn, taskname, taskhashlist, d):
             return siginfo.rpartition('.')[2]
 
     def get_time(fullpath):
-        try:
-            return os.stat(fullpath).st_mtime
-        except OSError:
-            return None
+        return os.stat(fullpath).st_mtime
 
     # First search in stamps dir
     localdata = d.createCopy()
Signature · 1 line
2.39.2
#1 lore raw
Quoted 19 lines · Alexander Kanavin

Suppressing the error and returning None can result in a delayed failure:
https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/6254/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6262/steps/14/logs/stdio

It is not clear why the os.stat() error occurs to begin with (it shouldn't), so rather than adding further workarounds, let's get diagnostics at the source first, so we understand what is going on.

---
 meta/lib/oe/sstatesig.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta/lib/oe/sstatesig.py +0 -0
index 0342bcdc87a..6f124e4f59b 100644
@@ -357,10 +357,7 @@ def find_siginfo(pn, taskname, taskhashlist, d):
             return siginfo.rpartition('.')[2]

meta/lib/oe/sstatesig.py def find_siginfo(pn, taskname, taskhashlist, d): · line 363

Quoted 10 lines
meta/lib/oe/sstatesig.py +1 -4
 
     def get_time(fullpath):
-        try:
-            return os.stat(fullpath).st_mtime
-        except OSError:
-            return None
+        return os.stat(fullpath).st_mtime
 
     # First search in stamps dir
     localdata = d.createCopy()

FWIW, this comes from:

https://git.yoctoproject.org/poky/commit/meta/lib/oe/sstatesig.py?id=3df8773ed9301b0fc0e385e066a48110900136f7

I also suspect it is possible for a file to exist as a temp file but get renamed into place while the test runs.

Cheers,

Richard

#2 lore raw

Right, I guess the code can be tweaked to not return entries where mtime could not be determined, but I'd like to observe the actual failure in the wild first, for the sake of a better commit message.

Alex

Quoted 42 lines · Richard Purdie
Quoted 19 lines · Alexander Kanavin

Suppressing the error and returning None can result in a delayed failure:
https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/6254/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6262/steps/14/logs/stdio

It is not clear why the os.stat() error occurs to begin with (it shouldn't), so rather than adding further workarounds, let's get diagnostics at the source first, so we understand what is going on.

---
 meta/lib/oe/sstatesig.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta/lib/oe/sstatesig.py +0 -0
index 0342bcdc87a..6f124e4f59b 100644
@@ -357,10 +357,7 @@ def find_siginfo(pn, taskname, taskhashlist, d):
             return siginfo.rpartition('.')[2]

meta/lib/oe/sstatesig.py def find_siginfo(pn, taskname, taskhashlist, d): · line 363

Quoted 10 lines
meta/lib/oe/sstatesig.py +1 -4
 
     def get_time(fullpath):
-        try:
-            return os.stat(fullpath).st_mtime
-        except OSError:
-            return None
+        return os.stat(fullpath).st_mtime
 
     # First search in stamps dir
     localdata = d.createCopy()

FWIW, this comes from:

https://git.yoctoproject.org/poky/commit/meta/lib/oe/sstatesig.py?id=3df8773ed9301b0fc0e385e066a48110900136f7

I also suspect it is possible for a file to exist as a temp file but get renamed into place while the test runs.

Cheers,

Richard