summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-09-28 17:57:27 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-10-01 16:45:29 +0100
commitc8677af0a175438926c1f7d163d05acbff261837 (patch)
tree4783ddc52a7d8118233ceb2f52675c3315d6b4a7
parentfafa81367d505cebe564d8f2dbf6cbee5bfcc118 (diff)
downloadbuildstream-jmac/vdir_import_unreadable_files.tar.gz
_process_list: Make files readable before copying/linkingjmac/vdir_import_unreadable_files
-rw-r--r--buildstream/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/buildstream/utils.py b/buildstream/utils.py
index 1e04a31ed..28ba0fb25 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -831,8 +831,18 @@ def _process_list(srcdir, destdir, filelist, actionfunc, result,
result.ignored.append(path)
continue
+ if not file_stat.st_mode & stat.S_IRUSR:
+ os.chmod(srcpath, file_stat.st_mode | stat.S_IRUSR)
+
actionfunc(srcpath, destpath, result=result)
+ if not file_stat.st_mode & stat.S_IRUSR:
+ # actionfunc would normally preserve permissions, but
+ # if we changed them before copying, we need to reset
+ # the permissions on both.
+ os.chmod(destpath, file_stat.st_mode)
+ os.chmod(srcpath, file_stat.st_mode)
+
elif stat.S_ISCHR(mode) or stat.S_ISBLK(mode):
# Block or character device. Put contents of st_dev in a mknod.
if not safe_remove(destpath):