Signed-off-by: Rob Browning <
r...@defaultvalue.org>
Tested-by: Rob Browning <
r...@defaultvalue.org>
---
.pylintrc | 1 +
lib/bup/cmd/fuse.py | 2 +-
test/int/test_helpers.py | 5 +++--
test/int/test_metadata.py | 5 +++--
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/.pylintrc b/.pylintrc
index bdfbbcbf..bda2a958 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -7,6 +7,7 @@ enable=
assert-on-string-literal,
assignment-from-no-return,
bad-classmethod-argument,
+ bare-except,
broad-exception-caught,
catching-non-exception,
chained-comparison,
diff --git a/lib/bup/cmd/fuse.py b/lib/bup/cmd/fuse.py
index ff5befb2..a5295713 100644
--- a/lib/bup/cmd/fuse.py
+++ b/lib/bup/cmd/fuse.py
@@ -22,7 +22,7 @@ fuse.fuse_python_api = (0, 2)
try:
fuse_ver = fuse.__version__.split('.')
fuse_ver_maj = int(fuse_ver[0])
-except:
+except (AttributeError, TypeError, ValueError):
print('error: cannot determine the fuse major version; please report',
file=sys.stderr)
sys.exit(2)
diff --git a/test/int/test_helpers.py b/test/int/test_helpers.py
index 0fae9882..2c5e32be 100644
--- a/test/int/test_helpers.py
+++ b/test/int/test_helpers.py
@@ -125,12 +125,13 @@ def test_atomically_replaced_file(sync_atomic_replace, tmpdir):
f = open(target_file, 'r', encoding='utf-8')
WVPASSEQ(f.read(), 'asdf')
+ class Escape(Exception): pass
try:
with atomically_replaced_file(target_file, mode='w',
sync=sync_atomic_replace) as f:
f.write('wxyz')
- raise Exception()
- except:
+ raise Escape()
+ except Escape:
pass
with open(target_file, encoding='utf-8') as f:
WVPASSEQ(f.read(), 'asdf')
diff --git a/test/int/test_metadata.py b/test/int/test_metadata.py
index a8713275..811e8dcb 100644
--- a/test/int/test_metadata.py
+++ b/test/int/test_metadata.py
@@ -201,8 +201,9 @@ def test_apply_to_path_restricted_access(tmpdir):
if metadata.xattr:
try:
metadata.xattr.set(path, b'user.buptest', b'bup')
- except:
- # ignore any failures here - maybe FS cannot do it
+ except IOError as ex: # matches _apply_linux_xattr_rec
+ if ex.errno not in (errno.EPERM, errno.EOPNOTSUPP):
+ raise
print("failed to set test xattr")
m = metadata.from_path(path, archive_path=path, save_symlinks=True)
WVPASSEQ(m.path, path)
--
2.47.3