Repository: borgbackup/borg

Issue:
testsuite failure on hppa
Hi, following the error:
(note: hppa is not a release architecture, so you can just close this issue)
https://buildd.debian.org/status/fetch.php?pkg=borgbackup&arch=hppa&ver=1.0.5-2&stamp=1468279857

```
I: pybuild base:184: cd /<<PKGBUILDDIR>>/.pybuild/pythonX.Y_3.5/build; python3.5 -m pytest -k 'not benchmark and not fuse_mount' --pyargs borg.testsuite
============================= test session starts ==============================
platform linux -- Python 3.5.2, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /<<PKGBUILDDIR>>, inifile: setup.cfg
plugins: cov-2.2.1
collected 0 items / 18 errors

==================================== ERRORS ====================================
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/__init__.py ___
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/archive.py ____
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/archiver.py ___
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
__ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/benchmark.py ___
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/chunker.py ____
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/compress.py ___
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
____ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/crypto.py ____
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
__ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/hashindex.py ___
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/helpers.py ____
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
_____ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/key.py ______
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/locking.py ____
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
____ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/logger.py ____
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/lrucache.py ___
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/platform.py ___
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
__ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/repository.py __
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
_ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/shellpattern.py _
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/upgrader.py ___
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
____ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/xattr.py _____
/usr/lib/python3/dist-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
========================== 18 error in 35.34 seconds ===========================
E: pybuild pybuild:274: test: plugin distutils failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/pythonX.Y_3.5/build; python3.5 -m pytest -k 'not benchmark and not fuse_mount' --pyargs borg.testsuite
dh_auto_test: pybuild --test -i python{version} -p 3.5 returned exit code 13
debian/rules:63: recipe for target 'override_dh_auto_test' failed
make[1]: *** [override_dh_auto_test] Error 25
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
debian/rules:46: recipe for target 'build-arch' failed
make: *** [build-arch] Error 2
dpkg-buildpackage: error: debian/rules build-arch gave error exit status 2
```

failure with eatmydata "tried to call a logger before setup_logging() was called"
As said on Debian bug 825729, with eatmydata borg fails.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825729

```
==================================== ERRORS ====================================
___ ERROR collecting .pybuild/pythonX.Y_3.5/build/borg/testsuite/__init__.py ___
borg/testsuite/__init__.py:10: in <module>
    from ..xattr import get_all
borg/xattr.py:71: in <module>
    logger.error(msg)
borg/logger.py:173: in error
    return self.__logger.error(*args, **kw)
borg/logger.py:150: in __logger
    raise Exception("tried to call a logger before setup_logging() was called")
E   Exception: tried to call a logger before setup_logging() was called
--------------------------------------------------------------------------------
```



Discussion:

I've  no idea what eatmydata is, but it seems to invoke borg / tests in an unusual way.
grep the borg source for `setup_logging` to see what you need to add?

package description:

```
Library and utilities designed to disable fsync and friends
This package contains a small LD_PRELOAD library (libeatmydata) and a couple of helper utilities designed to transparently disable fsync and friends (like open(O_SYNC)). This has two side-effects: making software that writes data safely to disk a lot quicker and making this software no longer crash safe.
You will find eatmydata useful if particular software calls fsync(), sync() etc. frequently but the data it stores is not that valuable to you and you may afford losing it in case of system crash. Data-to-disk synchronization calls are typically very slow on modern file systems and their extensive usage might slow down software significantly. It does not make sense to accept such a hit in performance if data being manipulated is not very important.
On the other hand, do not use eatmydata when you care about what software stores or it manipulates important components of your system. The library is called libEAT-MY-DATA for a reason. 
```

Not sure if fixable or worth a fix :)

> Not sure if fixable or worth a fix :)

Not worth a fix. fsync()iness is "fixed" in 1.1.

Edit: Disabling fsync() is a _really_ bad idea for Borg.

~~-- Does it crash at runtime? If not we might want to add a little code to make it...~~ Traceback suggests just that, nothing to do there.

Close?


Resolving patch:
diff --git a/borg/xattr.py b/borg/xattr.py
--- a/borg/xattr.py
+++ b/borg/xattr.py
@@ -2,6 +2,7 @@
 """
 import errno
 import os
+import re
 import subprocess
 import sys
 import tempfile
@@ -52,16 +53,23 @@ 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.
 # 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.
-LD_PRELOAD = os.environ.get('LD_PRELOAD', '')
-XATTR_FAKEROOT = False
-if sys.platform.startswith('linux') and 'fakeroot' in LD_PRELOAD:
-    fakeroot_version = LooseVersion(subprocess.check_output(['fakeroot', '-v']).decode('ascii').split()[-1])
-    if fakeroot_version >= LooseVersion("1.20.2"):
-        # 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 = LD_PRELOAD
-        XATTR_FAKEROOT = True
+try:
+    XATTR_FAKEROOT = False
+    if sys.platform.startswith('linux'):
+        LD_PRELOAD = os.environ.get('LD_PRELOAD', '')
+        preloads = re.split("[ :]", LD_PRELOAD)
+        for preload in preloads:
+            if preload.startswith("libfakeroot"):
+                fakeroot_version = LooseVersion(subprocess.check_output(['fakeroot', '-v']).decode('ascii').split()[-1])
+                if fakeroot_version >= LooseVersion("1.20.2"):
+                    # 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
+except:
+    pass
 
 try:
     libc = CDLL(libc_name, use_errno=True)


Test patch: