Skip to content

Commit 980f618

Browse files
committed
improve reliability of bit-wise operations setting file mode in reproducible archives
1 parent f2296de commit 980f618

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

easybuild/tools/filetools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2806,7 +2806,9 @@ def reproducible_filter(tarinfo):
28062806
tarinfo.mtime = 0
28072807
# reset file permissions by applying go+u,go-w
28082808
user_mode = tarinfo.mode & stat.S_IRWXU
2809-
tarinfo.mode = tarinfo.mode | user_mode >> 3 & ~stat.S_IWGRP | user_mode >> 6 & ~stat.S_IWOTH
2809+
group_mode = (user_mode >> 3) & ~stat.S_IWGRP # user mode without write
2810+
other_mode = group_mode >> 3 # user mode without write
2811+
tarinfo.mode = (tarinfo.mode & ~0o77) | group_mode | other_mode
28102812
# reset ownership numeric UID/GID 0
28112813
tarinfo.uid = tarinfo.gid = 0
28122814
tarinfo.uname = tarinfo.gname = ""

0 commit comments

Comments
 (0)