mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-01 20:55:16 +00:00
Correctly handle multiple LD_PRELOAD entries; fixes #1111
This commit is contained in:
parent
37835f7d6c
commit
d4f5172771
1 changed files with 14 additions and 10 deletions
|
@ -2,6 +2,7 @@
|
||||||
"""
|
"""
|
||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
@ -52,17 +53,20 @@ def get_all(path, follow_symlinks=True):
|
||||||
# the 'test_extract_capabilities' test, but also allows xattrs to work with fakeroot on Linux in normal use.
|
# the 'test_extract_capabilities' test, but also allows xattrs to work with fakeroot on Linux in normal use.
|
||||||
# TODO: Check whether fakeroot supports xattrs on all platforms supported below.
|
# TODO: Check whether fakeroot supports xattrs on all platforms supported below.
|
||||||
# TODO: If that's the case then we can make Borg fakeroot-xattr-compatible on these as well.
|
# TODO: If that's the case then we can make Borg fakeroot-xattr-compatible on these as well.
|
||||||
LD_PRELOAD = os.environ.get('LD_PRELOAD', '')
|
|
||||||
XATTR_FAKEROOT = False
|
XATTR_FAKEROOT = False
|
||||||
if sys.platform.startswith('linux') and 'fakeroot' in LD_PRELOAD:
|
if sys.platform.startswith('linux'):
|
||||||
fakeroot_version = LooseVersion(subprocess.check_output(['fakeroot', '-v']).decode('ascii').split()[-1])
|
LD_PRELOAD = os.environ.get('LD_PRELOAD', '')
|
||||||
if fakeroot_version >= LooseVersion("1.20.2"):
|
preloads = re.split("[ :]", LD_PRELOAD)
|
||||||
# 1.20.2 has been confirmed to have xattr support
|
for preload in preloads:
|
||||||
# 1.18.2 has been confirmed not to have xattr support
|
if preload.startswith("libfakeroot"):
|
||||||
# Versions in-between are unknown
|
fakeroot_version = LooseVersion(subprocess.check_output(['fakeroot', '-v']).decode('ascii').split()[-1])
|
||||||
libc_name = LD_PRELOAD
|
if fakeroot_version >= LooseVersion("1.20.2"):
|
||||||
XATTR_FAKEROOT = True
|
# 1.20.2 has been confirmed to have xattr support
|
||||||
|
# 1.18.2 has been confirmed not to have xattr support
|
||||||
|
# Versions in-between are unknown
|
||||||
|
libc_name = preload
|
||||||
|
XATTR_FAKEROOT = True
|
||||||
|
break
|
||||||
|
|
||||||
try:
|
try:
|
||||||
libc = CDLL(libc_name, use_errno=True)
|
libc = CDLL(libc_name, use_errno=True)
|
||||||
|
|
Loading…
Reference in a new issue