All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Steve Sakoman" <steve@sakoman.com>
To: openembedded-core@lists.openembedded.org
Subject: [OE-core][dunfell 15/19] sstate.bbclass: fix errors about read-only sstate mirrors
Date: Mon,  5 Jul 2021 12:34:52 -1000	[thread overview]
Message-ID: <4b5ab8868a563e12bea4df0bfb8309eff004e3e2.1625511812.git.steve@sakoman.com> (raw)
In-Reply-To: <cover.1625511812.git.steve@sakoman.com>

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

Signed-off-by: Michael Ho <Michael.Ho@bmw.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 244b3be0358a66e0cca4016fe26144e3d7323390)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/classes/sstate.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index a689f7f677..53dcfc8274 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 e.errno != errno.EROFS:
+                raise e
 
     return
 
@@ -1141,6 +1145,10 @@ python sstate_eventhandler() {
                 os.utime(siginfo, None)
             except PermissionError:
                 pass
+            except OSError as e:
+                # Handle read-only file systems gracefully
+                if e.errno != errno.EROFS:
+                    raise e
 
 }
 
-- 
2.25.1


  parent reply	other threads:[~2021-07-05 22:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 22:34 [OE-core][dunfell 00/19] Patch review Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 01/19] python3: skip tests requiring tools-sdk Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 02/19] python3: apply test skipping patch unconditionally Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 03/19] rpm: fix CVE-2021-3421 Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 04/19] gstreamer-plugins-base: fix CVE-2021-3522 Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 05/19] linux-yocto/5.4: update to v5.4.124 Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 06/19] linux-yocto/5.4: update to v5.4.125 Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 07/19] linux-yocto/5.4: update to v5.4.128 Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 08/19] linux-yocto/5.4: update to v5.4.129 Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 09/19] kernel: Fix interaction when packaging disabled Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 10/19] kernel-devicetree: " Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 11/19] selftest: do not hardcode /tmp/sdk Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 12/19] perf: Use python3targetconfig to ensure we use target libraries Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 13/19] pypi: set SRC_URI with _prepend, not with += Steve Sakoman
2021-07-06  8:30   ` Martin Jansa
2021-07-06  8:41     ` Khem Raj
2021-07-06 14:16     ` Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 14/19] package_pkgdata: Avoid task hash mismatches for generic task changes Steve Sakoman
2021-07-05 22:34 ` Steve Sakoman [this message]
2021-07-05 22:34 ` [OE-core][dunfell 16/19] oeqa/selftest/runcmd: Tweal test timeouts Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 17/19] sstate/staging: Handle directory creation race issue Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 18/19] devtool: deploy-target: Fix preserving attributes when using --strip Steve Sakoman
2021-07-05 22:34 ` [OE-core][dunfell 19/19] oeqa/selftest/archiver: Allow tests to ignore empty directories Steve Sakoman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b5ab8868a563e12bea4df0bfb8309eff004e3e2.1625511812.git.steve@sakoman.com \
    --to=steve@sakoman.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.