@@ -30,7 +30,7 @@ def runstrip(file, elftype, strip, extra_strip_sections=''):
# 16 - kernel module
newmode = None
- if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
+ if not os.access(file, os.R_OK | os.W_OK):
origmode = os.stat(file)[stat.ST_MODE]
newmode = origmode | stat.S_IWRITE | stat.S_IREAD
os.chmod(file, newmode)
@@ -780,7 +780,7 @@ def splitdebuginfo(file, dvar, dv, d):
objcopy = d.getVar("OBJCOPY")
newmode = None
- if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
+ if not os.access(file, os.R_OK | os.W_OK):
origmode = os.stat(file)[stat.ST_MODE]
newmode = origmode | stat.S_IWRITE | stat.S_IREAD
os.chmod(file, newmode)
@@ -822,7 +822,7 @@ def splitstaticdebuginfo(file, dvar, dv, d):
dvar = d.getVar('PKGD')
newmode = None
- if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
+ if not os.access(file, os.R_OK | os.W_OK):
origmode = os.stat(file)[stat.ST_MODE]
newmode = origmode | stat.S_IWRITE | stat.S_IREAD
os.chmod(file, newmode)
Various bits of package.py manipulate executables on disk, for example stripping the binary or extracting the debug info. Some recipes write read-only libraries (notably, perl-native) so we need to check for this and add writable permissions briefly. However, this logic was incorrect. The line is: if not os.access(file, os.W_OK) or os.access(file, os.R_OK): 'not' has higher precedence than 'or', so this is "if not writable, or if readable" so we were always changing the permissions, even on files we can read and write. The desired behaviour is to change permissions if we can't read or write the file, which can be done in a single access check: if not os.access(file, os.R_OK | os.W_OK): Signed-off-by: Ross Burton <ross.burton@arm.com> --- meta/lib/oe/package.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)