Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Phil Blundell <philb@gnu.org>
To: openembedded-core@lists.openembedded.org
Subject: wrong umask used for creating sstate-cache directories
Date: Mon, 15 Oct 2012 22:15:34 +0100	[thread overview]
Message-ID: <1350335734.4470.108.camel@x121e.pbcl.net> (raw)

We've been experiencing a problem for a while with the group write bit
going missing on directories which are created inside sstate-cache.
This afternoon I finally had some time to investigate the cause of the
problem.

What appears to be happening is that, due to the way that sstate hooks
in its prefuncs/postfuncs, sstate_package() ends up inheriting any umask
which was set on the that that it's wrapping.  In particular, for
reasons that I'm not entirely clear about, base.bbclass does:

    if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
        d.setVarFlag('do_configure', 'umask', 022)
        d.setVarFlag('do_compile', 'umask', 022)
        d.appendVarFlag('do_install', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
        d.setVarFlag('do_install', 'fakeroot', 1)
        d.setVarFlag('do_install', 'umask', 022)
        d.appendVarFlag('do_package', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')
        d.setVarFlag('do_package', 'fakeroot', 1)
        d.setVarFlag('do_package', 'umask', 022)
        d.setVarFlag('do_package_setscene', 'fakeroot', 1)

and staging.bbclass does:

	do_populate_sysroot[umask] = "022"

sstate_create_package() takes care to explicitly change the mode on the
newly-created archive file to 0664, but there is no equivalent handling
for the directories created by the mkdirhier() calls in sstate_package()
and those end up getting their mode determined by the umask in effect.

In order to work around this problem I've applied this patch locally:

--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -507,7 +507,11 @@ python sstate_task_postfunc () {
     sstate_install(shared_state, d)
     for intercept in shared_state['interceptfuncs']:
         bb.build.exec_func(intercept, d)
+    omask = os.umask(002)
+    if omask != 002:
+       bb.note("Using umask 002 (not %03o) for sstate packaging" % omask)
     sstate_package(shared_state, d)
+    os.umask(omask)

but this is clearly not ideal for general consumption either since some
people might actually want umask 022 for those directories.  The ideal
thing would be if bitbake could either restore the original umask before
running the postfuncs, or at least allow code in the postfunc to find
out what the original umask was so that it could restore it for itself.

Any better suggestions?

p.





                 reply	other threads:[~2012-10-15 21:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1350335734.4470.108.camel@x121e.pbcl.net \
    --to=philb@gnu.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox