Skip to content

Commit 5f03cee

Browse files
authored
Ensure that system-copied lib is writable before running patchelf (#237)
1 parent 5fd5e27 commit 5f03cee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

auditwheel/repair.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import re
3+
import stat
34
import shutil
45
import itertools
56
import functools
@@ -137,6 +138,9 @@ def copylib(src_path, dest_dir):
137138
logger.debug('Grafting: %s -> %s', src_path, dest_path)
138139
rpaths = elf_read_rpaths(src_path)
139140
shutil.copy2(src_path, dest_path)
141+
statinfo = os.stat(dest_path)
142+
if not statinfo.st_mode & stat.S_IWRITE:
143+
os.chmod(dest_path, statinfo.st_mode | stat.S_IWRITE)
140144

141145
verify_patchelf()
142146
check_call(['patchelf', '--set-soname', new_soname, dest_path])

0 commit comments

Comments
 (0)