Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] package.bbclass: Clear umask when using os.mkdir
@ 2013-09-25 12:36 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2013-09-25 12:36 UTC (permalink / raw)
  To: openembedded-core

We switched to using os.mkdir with the file creation mode specified as the
second parameter. Python masks this with umask behind the scenes which isn't
what we want, we really want the permissions we specify.

To avoid this we zero the umask beforehand and restore afterwards. Other
solutions are possible but would not perform as well which is why
we're using os.mkdir in the first place.

Martin Jansa deserves the credit for debugging where the problem was.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index fbb6839..c98c6ec 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -953,6 +953,9 @@ python populate_packages () {
 
     seen = []
 
+    # os.mkdir masks the permissions with umask so we have to unset it first
+    oldumask = os.umask(0)
+
     for pkg in package_list:
         root = os.path.join(pkgdest, pkg)
         bb.utils.mkdirhier(root)
@@ -1025,6 +1028,7 @@ python populate_packages () {
             if ret is False or ret == 0:
                 raise bb.build.FuncFailed("File population failed")
 
+    os.umask(oldumask)
     os.chdir(workdir)
 
     unshipped = []




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-25 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-25 12:36 [PATCH] package.bbclass: Clear umask when using os.mkdir Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox