瀏覽代碼

implement BORG_LIBC env variable, fixes #5870

Thomas Waldmann 4 年之前
父節點
當前提交
a4f7e69f4e
共有 2 個文件被更改,包括 6 次插入1 次删除
  1. 5 0
      docs/usage/general/environment.rst.inc
  2. 1 1
      src/borg/xattr.py

+ 5 - 0
docs/usage/general/environment.rst.inc

@@ -68,6 +68,11 @@ General:
         When set to no (default: yes), system information (like OS, Python version, ...) in
         When set to no (default: yes), system information (like OS, Python version, ...) in
         exceptions is not shown.
         exceptions is not shown.
         Please only use for good reasons as it makes issues harder to analyze.
         Please only use for good reasons as it makes issues harder to analyze.
+    BORG_LIBC
+        borg uses ``ctypes.util.find_library`` to locate the 'c' library (aka libc).
+        find_library needs a shell and will invoke some tools like ldconfig, gcc/cc or objdump.
+        If a shell or these tools are not available, you can give the name of your libc via
+        BORG_LIBC=libc.so.6 (for example) and borg will not try the ``find_library`` call.
     BORG_SELFTEST
     BORG_SELFTEST
         This can be used to influence borg's builtin self-tests. The default is to execute the tests
         This can be used to influence borg's builtin self-tests. The default is to execute the tests
         at the beginning of each borg command invocation.
         at the beginning of each borg command invocation.

+ 1 - 1
src/borg/xattr.py

@@ -62,7 +62,7 @@ def get_all(path, follow_symlinks=True):
             return {}
             return {}
 
 
 
 
-libc_name = find_library('c')
+libc_name = os.environ.get('BORG_LIBC') or find_library('c')
 if libc_name is None:
 if libc_name is None:
     # find_library didn't work, maybe we are on some minimal system that misses essential
     # find_library didn't work, maybe we are on some minimal system that misses essential
     # tools used by find_library, like ldconfig, gcc/cc, objdump.
     # tools used by find_library, like ldconfig, gcc/cc, objdump.