Comment 0 for bug 2028666

Revision history for this message
nikhil kshirsagar (nkshirsagar) wrote : remote magic related warning for focal and bionic

focal and bionic do not have the required version of python3-magic for the new approach to binary file detection. Accordingly we will patch them with a patch like this,

Description: Remove python3-magic related warning
Do not bother spewing a warning about python3-magic version since
that breaks autopkg tests due to the stderr spew. There's nothing
that we can do anyway about it, since focal would not have the
python3-magic version that sos needs for the new approach.
Bug: https://github.com/sosreport/sos/issues/3021
Applied-Upstream: https://github.com/sosreport/sos/pull/3025
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: sos-4.5.6/sos/utilities.py
===================================================================
--- sos-4.5.6.orig/sos/utilities.py
+++ sos-4.5.6/sos/utilities.py
@@ -29,20 +29,6 @@ except SyntaxError:

 # try loading magic>=0.4.20 which implements detect_from_filename method
 magic_mod = False
-try:
- import magic
- magic.detect_from_filename(__file__)
- magic_mod = True
-except (ImportError, AttributeError):
- log = logging.getLogger('sos')
- from textwrap import fill
- msg = ("""\
-WARNING: Failed to load 'magic' module version >= 0.4.20 which sos aims to \
-use for detecting binary files. A less effective method will be used. It is \
-recommended to install proper python3-magic package with the module.
-""")
- log.warning('\n' + fill(msg, 72, replace_whitespace=False) + '\n')
-

 TIMEOUT_DEFAULT = 300

This is to avoid autopkgtest failures due to the stderr spew of that warning. See https://bugs.launchpad.net/ubuntu/+source/sosreport/+bug/2022915/comments/37