Bug 5590

Summary: System umask respected in checkout from git
Product: [Build System, Metadata & Runtime] BitBake Reporter: Martin Jansa <Martin.Jansa>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher
Version: 1.6   
Target Milestone: 1.6   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Martin Jansa 2013-11-22 16:27:59 UTC
base.bbclass sets umask 022 for some tasks do_configure, do_install, do_package, but some files are copied with file permissions as they were in e.g. git checkout and this checkout should be the same on all builders, independent from system umask set on them.

Steps to reproduce:

# just in case
rm -rf tmp-eglibc/work/arm920tt-oe-linux-gnueabi/gnu-config/1.0+gitAUTOINC+a47f842264-r0/

umask 0022
bitbake -c cleansstate gnu-config
bitbake -c unpack -b openembedded-core/meta/recipes-devtools/gnu-config/gnu-config_git.bb
ls -laR tmp-eglibc/work/arm920tt-oe-linux-gnueabi/gnu-config/1.0+gitAUTOINC+a47f842264-r0/git/ > ls-laR-0022.txt

# just in case
rm -rf tmp-eglibc/work/arm920tt-oe-linux-gnueabi/gnu-config/1.0+gitAUTOINC+a47f842264-r0/

umask 0002
bitbake -c cleansstate -b openembedded-core/meta/recipes-devtools/gnu-config/gnu-config_git.bb
bitbake -c unpack -b openembedded-core/meta/recipes-devtools/gnu-config/gnu-config_git.bb
ls -laR tmp-eglibc/work/arm920tt-oe-linux-gnueabi/gnu-config/1.0+gitAUTOINC+a47f842264-r0/git/ > ls-laR-0002.txt

diff ls-laR-00* | head -n 20
3,11c3,11
< drwxrwxr-x 4 bitbake bitbake  4096 Nov 22 16:09 .
< drwxrwxr-x 4 bitbake bitbake  4096 Nov 22 16:09 ..
< drwxrwxr-x 7 bitbake bitbake  4096 Nov 22 16:09 .git
< -rw-rw-r-- 1 bitbake bitbake 74298 Nov 22 16:09 ChangeLog
< -rw-rw-r-- 1 bitbake bitbake    81 Nov 22 16:09 Makefile
< -rwxrwxr-x 1 bitbake bitbake 44525 Nov 22 16:09 config.guess
< -rwxrwxr-x 1 bitbake bitbake 35370 Nov 22 16:09 config.sub
< drwxrwxr-x 2 bitbake bitbake  4096 Nov 22 16:09 testsuite
< -rwxrwxr-x 1 bitbake bitbake   244 Nov 22 16:09 uname
---
> drwxr-xr-x 4 bitbake bitbake  4096 Nov 22 16:14 .
> drwxr-xr-x 4 bitbake bitbake  4096 Nov 22 16:14 ..
> drwxr-xr-x 7 bitbake bitbake  4096 Nov 22 16:14 .git
> -rw-r--r-- 1 bitbake bitbake 74298 Nov 22 16:14 ChangeLog
> -rw-r--r-- 1 bitbake bitbake    81 Nov 22 16:14 Makefile
> -rwxr-xr-x 1 bitbake bitbake 44525 Nov 22 16:14 config.guess
> -rwxr-xr-x 1 bitbake bitbake 35370 Nov 22 16:14 config.sub
> drwxr-xr-x 2 bitbake bitbake  4096 Nov 22 16:14 testsuite
> -rwxr-xr-x 1 bitbake bitbake   244 Nov 22 16:14 uname

I've added setting umask varflag in base.bbclass and later some debug because it didn't work:
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 93bc700..76a41c3 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -485,6 +485,7 @@ python () {
     # If we're building a target package we need to use fakeroot (pseudo)
     # in order to capture permissions, owners, groups and special files
     if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
+        d.setVarFlag('do_unpack', 'umask', 022)
         d.setVarFlag('do_configure', 'umask', 022)
         d.setVarFlag('do_compile', 'umask', 022)
         d.appendVarFlag('do_install', 'depends', ' virtual/fakeroot-native:do_populate_sysroot')

Seems to be working, will send patch in few minutes
Comment 2 Richard Purdie 2013-11-29 10:59:12 UTC
Fixed in master with http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=79fbb1f69815abd3b835678a8e4b9114f6f0290e (thanks Martin!)