All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: "Richard Purdie via lists.openembedded.org"
	<richard.purdie=linuxfoundation.org@lists.openembedded.org>
Cc: openembedded-core@lists.openembedded.org,
	richard.purdie@linuxfoundation.org
Subject: Re: [OE-core] [PATCH] sstate.bbclass: apply proper umask when fetching from SSTATE_MIRROR
Date: Tue, 17 Jun 2025 09:41:49 +0200	[thread overview]
Message-ID: <87ikkuzuf6.fsf@prevas.dk> (raw)
In-Reply-To: <0088740e272e5c9a1181de3f258c7ace3f7f3e17.camel@linuxfoundation.org> (Richard Purdie via lists openembedded org's message of "Sun, 15 Jun 2025 22:17:04 +0100")

On Sun, Jun 15 2025, "Richard Purdie via lists.openembedded.org" <richard.purdie=linuxfoundation.org@lists.openembedded.org> wrote:

> On Fri, 2025-06-06 at 11:39 +0200, Rasmus Villemoes wrote:
>> From: Rasmus Villemoes <ravi@prevas.dk>
>> 
>> 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.
>> 

> I appreciate this sounds crazy but this is causing some kind of
> regression being reported in our automated testing. Specifically,
> running:
>
> oe-selftest -r sstatetests.SStateCreation -j 1
>
> fails for me locally with this applied, as it does here in CI:
>
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/1767
>
> Worryingly, if I run:
>
> oeselftest -r sstatetests.SStateCreation.test_sstate_creation_distro_specific_pass -j 1
>
> i.e. a specific failing test, that fails even without the patch
> applied, and it shouldn't so there is something odd going on here even
> before the patch.
>
> We're going to have to get to the bottom of this before I can merge the
> patch.

Fair enough.

I'm not sure I can help much, but looking at that test code, something
feels a little fishy:

        # Now we'll walk the tree to check the mode and see if things are incorrect.
        badperms = []
        for root, dirs, files in os.walk(self.sstate_path):
            for directory in dirs:
                if (os.stat(os.path.join(root, directory)).st_mode & 0o777) != 0o775:
                    badperms.append(os.path.join(root, directory))

        # Return to original umask
        os.umask(orig_umask)

        if should_pass:
            self.assertTrue(badperms , msg="Found sstate directories with the wrong permissions: %s (found %s)" % (', '.join(map(str, targets)), str(badperms)))

So badperms is a list of stuff we've found that has ended up with wrong
permissions. But AFAICT, we assert that badperms is 'truish',
i.e. non-empty.

Just guessing: Perhaps the reason that passes on CI is exactly because
it always ends up getting the artifacts from an SSTATE_MIRROR (thus with
"wrong" permissions in the current state of the sstate mirror fetching),
while perhaps you don't when you run it locally, and thus you do see the
failure because your local dirs end up being created with the right 0775
perms, and badperms ends up empty?

While in there, the current_umask() helper seems redundant; just doing

  orig_umask = os.umask(0o022)

would do exactly what one wants.

Rasmus


  reply	other threads:[~2025-06-17  7:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06  9:39 [PATCH] sstate.bbclass: apply proper umask when fetching from SSTATE_MIRROR Rasmus Villemoes
2025-06-13 16:30 ` Richard Purdie
2025-06-13 19:42   ` [OE-core] " Ryan Eatmon
2025-06-15 21:17 ` Richard Purdie
2025-06-17  7:41   ` Rasmus Villemoes [this message]
2025-06-25 13:54     ` [OE-core] " Richard Purdie
2025-06-26  6:51       ` Rasmus Villemoes
2025-06-26 10:06         ` Richard Purdie
2025-06-26 12:50           ` Rasmus Villemoes
2025-06-26 14:05             ` Richard Purdie
     [not found] <18466AB4BE83FB99.2470@lists.openembedded.org>
2025-06-13 11:43 ` Rasmus Villemoes

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=87ikkuzuf6.fsf@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie=linuxfoundation.org@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.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.