diff mbox series

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

Message ID 20240102145000.741634-1-alex@linutronix.de
State Accepted, archived
Commit 35483d4756ab53805507f72a9a0edb3f83759694
Headers show
Series lib/sstatesig/find_siginfo: raise an error instead of returning None when obtaining mtime | expand

Commit Message

Alexander Kanavin Jan. 2, 2024, 2:50 p.m. UTC
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.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/lib/oe/sstatesig.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Richard Purdie Jan. 5, 2024, 10:46 a.m. UTC | #1
On Tue, 2024-01-02 at 15:50 +0100, Alexander Kanavin wrote:
> 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.
> 
> Signed-off-by: Alexander Kanavin <alex@linutronix.de>
> ---
>  meta/lib/oe/sstatesig.py | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
> index 0342bcdc87a..6f124e4f59b 100644
> --- a/meta/lib/oe/sstatesig.py
> +++ b/meta/lib/oe/sstatesig.py
> @@ -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()

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
Alexander Kanavin Jan. 5, 2024, 10:57 a.m. UTC | #2
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

On Fri, 5 Jan 2024 at 11:46, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Tue, 2024-01-02 at 15:50 +0100, Alexander Kanavin wrote:
> > 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.
> >
> > Signed-off-by: Alexander Kanavin <alex@linutronix.de>
> > ---
> >  meta/lib/oe/sstatesig.py | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
> > index 0342bcdc87a..6f124e4f59b 100644
> > --- a/meta/lib/oe/sstatesig.py
> > +++ b/meta/lib/oe/sstatesig.py
> > @@ -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()
>
> 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
diff mbox series

Patch

diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index 0342bcdc87a..6f124e4f59b 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -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()