Jim MacArthur pushed to branch jmac/vdir_import_unreadable_files at BuildStream / buildstream
Commits:
-
c8677af0
by Jim MacArthur at 2018-10-01T15:45:29Z
1 changed file:
Changes:
... | ... | @@ -831,8 +831,18 @@ def _process_list(srcdir, destdir, filelist, actionfunc, result, |
831 | 831 |
result.ignored.append(path)
|
832 | 832 |
continue
|
833 | 833 |
|
834 |
+ if not file_stat.st_mode & stat.S_IRUSR:
|
|
835 |
+ os.chmod(srcpath, file_stat.st_mode | stat.S_IRUSR)
|
|
836 |
+ |
|
834 | 837 |
actionfunc(srcpath, destpath, result=result)
|
835 | 838 |
|
839 |
+ if not file_stat.st_mode & stat.S_IRUSR:
|
|
840 |
+ # actionfunc would normally preserve permissions, but
|
|
841 |
+ # if we changed them before copying, we need to reset
|
|
842 |
+ # the permissions on both.
|
|
843 |
+ os.chmod(destpath, file_stat.st_mode)
|
|
844 |
+ os.chmod(srcpath, file_stat.st_mode)
|
|
845 |
+ |
|
836 | 846 |
elif stat.S_ISCHR(mode) or stat.S_ISBLK(mode):
|
837 | 847 |
# Block or character device. Put contents of st_dev in a mknod.
|
838 | 848 |
if not safe_remove(destpath):
|