blob: 71ae518d84b7b9e719609514c7f7c5067c549258 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
diff --color -aur LHAPDF-6.5.2-old/bin/lhapdf LHAPDF-6.5.2-new/bin/lhapdf
--- LHAPDF-6.5.2-old/bin/lhapdf 2022-08-19 17:25:17.896370763 +0300
+++ LHAPDF-6.5.2-new/bin/lhapdf 2022-08-19 17:26:41.193035357 +0300
@@ -169,8 +169,26 @@
tarpath = os.path.join(dest_dir, tar_filename)
try:
+ import stat
import tarfile
+ stat_info = os.stat(tarpath)
+ # we only really care if destination is world readable
+ world_readable = bool(stat_info.st_mode & stat.S_IROTH)
+ file_mode = 0o644 if world_readable else 0o640
+ dir_mode = 0o755 if world_readable else 0o750
+ # load PDF tar file
tar_file = tarfile.open(tarpath, "r:gz")
+ for tar_info in tar_file.getmembers():
+ # adjust tar file properties
+ tar_info.uid = 0
+ tar_info.gid = 0
+ tar_info.uname = ""
+ tar_info.gname = ""
+ if tar_info.isfile():
+ tar_info.mode = file_mode
+ if tar_info.isdir():
+ tar_info.mode = dir_mode
+ # extract PDF tar file
if hasattr(tarfile, "data_filter"):
tar_file.extractall(dest_dir, filter="data")
else: # TODO: remove this and the attr test when Py < 3.12 is unnecessary
|