All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sstate.bbclass: fix errors about read-only sstate mirrors
@ 2021-06-24 10:40 Michael Ho
  2021-06-25  9:53 ` [OE-core] " Peter Kjellerstedt
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ho @ 2021-06-24 10:40 UTC (permalink / raw)
  To: openembedded-core; +Cc: Michael Ho

From: Michael Ho <Michael.Ho@bmw.de>

If a read-only sstate mirror is used in conjunction with hash equiv,
then OSError will be raised when an sstate-cache hit is achieved.

This is because sstate_task_postfunc will try to "touch" the symlinks
that point to the read-only sstate mirror when sstate_report_unihash
has changed SSTATE_PKG.

This commit adds an additional exception handler to silently mask read
only rootfs errors thrown during the touch.

The fix is also duplicated to sstate_eventhandler as the code is very
similar but it may not be needed there.

Example of the error:

File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:sstate_task_postfunc(d)
     0003:
File: '/poky/meta/classes/sstate.bbclass', lineno: 774, function: sstate_task_postfunc
     0770:
     0771:    omask = os.umask(0o002)
     0772:    if omask != 0o002:
     0773:       bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
 *** 0774:    sstate_package(shared_state, d)
     0775:    os.umask(omask)
     0776:
     0777:    sstateinst = d.getVar("SSTATE_INSTDIR")
     0778:    d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/poky/meta/classes/sstate.bbclass', lineno: 703, function: sstate_package
     0699:    if not os.path.exists(siginfo):
     0700:        bb.siggen.dump_this_task(siginfo, d)
     0701:    else:
     0702:        try:
 *** 0703:            os.utime(siginfo, None)
     0704:        except PermissionError:
     0705:            pass
     0706:
     0707:    return
Exception: OSError: [Errno 30] Read-only file system
---
 meta/classes/sstate.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 3a3f7cc24b..163f97495c 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -703,6 +703,10 @@ def sstate_package(ss, d):
             os.utime(siginfo, None)
         except PermissionError:
             pass
+        except OSError as e:
+            # Handle read-only file systems gracefully
+            if not e.errno == 30:
+                raise e
 
     return
 
@@ -1145,6 +1149,10 @@ python sstate_eventhandler() {
                 os.utime(siginfo, None)
             except PermissionError:
                 pass
+            except OSError as e:
+                # Handle read-only file systems gracefully
+                if not e.errno == 30:
+                    raise e
 
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [OE-core] [PATCH] sstate.bbclass: fix errors about read-only sstate mirrors
  2021-06-24 10:40 [PATCH] sstate.bbclass: fix errors about read-only sstate mirrors Michael Ho
@ 2021-06-25  9:53 ` Peter Kjellerstedt
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Kjellerstedt @ 2021-06-25  9:53 UTC (permalink / raw)
  To: Michael Ho, openembedded-core

> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-
> core@lists.openembedded.org> On Behalf Of Michael Ho
> Sent: den 24 juni 2021 12:40
> To: openembedded-core@lists.openembedded.org
> Cc: Michael Ho <Michael.Ho@bmw.de>
> Subject: [OE-core] [PATCH] sstate.bbclass: fix errors about read-only sstate mirrors
> 
> From: Michael Ho <Michael.Ho@bmw.de>
> 
> If a read-only sstate mirror is used in conjunction with hash equiv,
> then OSError will be raised when an sstate-cache hit is achieved.
> 
> This is because sstate_task_postfunc will try to "touch" the symlinks
> that point to the read-only sstate mirror when sstate_report_unihash
> has changed SSTATE_PKG.
> 
> This commit adds an additional exception handler to silently mask read
> only rootfs errors thrown during the touch.
> 
> The fix is also duplicated to sstate_eventhandler as the code is very
> similar but it may not be needed there.
> 
> Example of the error:
> 
> File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
>      0001:
>  *** 0002:sstate_task_postfunc(d)
>      0003:
> File: '/poky/meta/classes/sstate.bbclass', lineno: 774, function: sstate_task_postfunc
>      0770:
>      0771:    omask = os.umask(0o002)
>      0772:    if omask != 0o002:
>      0773:       bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
>  *** 0774:    sstate_package(shared_state, d)
>      0775:    os.umask(omask)
>      0776:
>      0777:    sstateinst = d.getVar("SSTATE_INSTDIR")
>      0778:    d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
> File: '/poky/meta/classes/sstate.bbclass', lineno: 703, function: sstate_package
>      0699:    if not os.path.exists(siginfo):
>      0700:        bb.siggen.dump_this_task(siginfo, d)
>      0701:    else:
>      0702:        try:
>  *** 0703:            os.utime(siginfo, None)
>      0704:        except PermissionError:
>      0705:            pass
>      0706:
>      0707:    return
> Exception: OSError: [Errno 30] Read-only file system
> ---
>  meta/classes/sstate.bbclass | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 3a3f7cc24b..163f97495c 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -703,6 +703,10 @@ def sstate_package(ss, d):
>              os.utime(siginfo, None)
>          except PermissionError:
>              pass
> +        except OSError as e:
> +            # Handle read-only file systems gracefully
> +            if not e.errno == 30:

Please change this to:

            if e.errno != errno.EROFS:

> +                raise e
> 
>      return
> 
> @@ -1145,6 +1149,10 @@ python sstate_eventhandler() {
>                  os.utime(siginfo, None)
>              except PermissionError:
>                  pass
> +            except OSError as e:
> +                # Handle read-only file systems gracefully
> +                if not e.errno == 30:
> +                    raise e

Same as above.

> 
>  }
> 
> --
> 2.25.1

//Peter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-25  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 10:40 [PATCH] sstate.bbclass: fix errors about read-only sstate mirrors Michael Ho
2021-06-25  9:53 ` [OE-core] " Peter Kjellerstedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.