[bitbake-devel] [PATCH 1/1] utils.py: default mode for mkdirhier

Peter Seebach peter.seebach at windriver.com
Mon May 19 21:52:44 UTC 2014


The default behavior of os.makedirs() is to create a directory
with mode 777 & ~umask. When populating packages, oe-core uses
a umask of 0, so that files and directories copied in from the
source tree will have the right modes, and that's reasonable,
but it can result in packages-split being created with mode 777,
which is not so reasonable.

Since mkdirhier is used for build system stuff, it is
pretty reasonable for it to assume that you don't want or need
world-writeable directories, so we add a default mode, allowing
a caller to override it if they really want to. Which they
don't.

Signed-off-by: Peter Seebach <peter.seebach at windriver.com>
---
 lib/bb/utils.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 1be1874..cd16b3b 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -618,13 +618,13 @@ def prune_suffix(var, suffixes, d):
             return var.replace(suffix, "")
     return var
 
-def mkdirhier(directory):
+def mkdirhier(directory, mode = 0755):
     """Create a directory like 'mkdir -p', but does not complain if
     directory already exists like os.makedirs
     """
 
     try:
-        os.makedirs(directory)
+        os.makedirs(directory, mode)
     except OSError as e:
         if e.errno != errno.EEXIST:
             raise e
-- 
1.7.1




More information about the bitbake-devel mailing list