[oe-commits] Richard Purdie : package.bbclass: Clear umask when using os.mkdir

git at git.openembedded.org git at git.openembedded.org
Wed Sep 25 16:37:07 UTC 2013


Module: openembedded-core.git
Branch: master-next
Commit: bb1bba706e1b6fdb022c9fe2e5099a5536d9d011
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=bb1bba706e1b6fdb022c9fe2e5099a5536d9d011

Author: Richard Purdie <richard.purdie at linuxfoundation.org>
Date:   Wed Sep 25 12:36:46 2013 +0000

package.bbclass: Clear umask when using os.mkdir

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 at linuxfoundation.org>
Signed-off-by: Saul Wold <sgw at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/package.bbclass |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

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 = []



More information about the Openembedded-commits mailing list