From 344bc2f1c273f0c776468c8ac61dfaa06bdd8853 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 27 Jun 2025 09:41:31 +0200 Subject: [PATCH] sstate: apply proper umask when fetching from SSTATE_MIRROR Currently, files and directories created under ${SSTATE_DIR} when fetching from an sstate mirror are not created with group write, unlike when the sstate artifacts are generated locally. That's inconsistent, and problematic when the local sstate dir is shared among multiple users. Wrap the fetching in a bb.utils.umask() context manager, and for simplicity move the mkdir of SSTATE_DIR inside that. (From OE-Core rev: e56aa6c62e41667d0eeec5a862b7004d21b4da48) Signed-off-by: Rasmus Villemoes Signed-off-by: Richard Purdie (cherry picked from commit a6038553aaef3b88b834a09018c524c4fa41e625) Signed-off-by: Steve Sakoman --- meta/classes-global/sstate.bbclass | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass index 2c259a6657..b98fbba982 100644 --- a/meta/classes-global/sstate.bbclass +++ b/meta/classes-global/sstate.bbclass @@ -726,7 +726,6 @@ def pstaging_fetch(sstatefetch, d): localdata = bb.data.createCopy(d) dldir = localdata.expand("${SSTATE_DIR}") - bb.utils.mkdirhier(dldir) localdata.delVar('MIRRORS') localdata.setVar('FILESPATH', dldir) @@ -746,16 +745,19 @@ def pstaging_fetch(sstatefetch, d): if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False): uris += ['file://{0}.sig;downloadfilename={0}.sig'.format(sstatefetch)] - for srcuri in uris: - localdata.delVar('SRC_URI') - localdata.setVar('SRC_URI', srcuri) - try: - fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False) - fetcher.checkstatus() - fetcher.download() + with bb.utils.umask(0o002): + bb.utils.mkdirhier(dldir) - except bb.fetch2.BBFetchException: - pass + for srcuri in uris: + localdata.delVar('SRC_URI') + localdata.setVar('SRC_URI', srcuri) + try: + fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False) + fetcher.checkstatus() + fetcher.download() + + except bb.fetch2.BBFetchException: + pass def sstate_setscene(d): shared_state = sstate_state_fromvars(d)