Activity log for bug #2028666

Date Who What changed Old value New value Message
2023-07-25 10:56:50 nikhil kshirsagar bug added bug
2023-07-25 10:57:01 nikhil kshirsagar sosreport (Ubuntu): status New Fix Committed
2023-07-25 10:57:06 nikhil kshirsagar sosreport (Ubuntu): assignee nikhil kshirsagar (nkshirsagar)
2023-07-26 03:56:54 nikhil kshirsagar summary remote magic related warning for focal and bionic remove magic related warning for focal and bionic
2023-07-26 07:31:01 nikhil kshirsagar description 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 [IMPACT] bionic and focal "sos report" command spews this warning on stderr and sos defaults to an older approach for binary detection. " 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. " This stderr output warning causes autopkgtests to fail for focal and bionic. This patch avoids showing the warning since focal and bionic would anyway never get the python3-magic version needed (0.4.20) so there is no point warning about this and it's better simply to use to the older approach without checking for this version of python3-magic. See https://bugs.launchpad.net/ubuntu/+source/sosreport/+bug/2022915/comments/37 [TEST PLAN] Documentation for Special Cases: https://wiki.ubuntu.com/SosreportUpdates [WHERE PROBLEMS COULD OCCUR] Since this patch avoid looking for python3-magic itself it may cause issues in sosreport in other places where there is an assumption about python3-magic having at least being attempted loading. I have however gone through the code and ruled this out, so this patch looks quite safe to me.
2023-07-26 07:31:57 nikhil kshirsagar attachment added 0002-debian-remove-magic-stderr.patch https://bugs.launchpad.net/ubuntu/+source/sosreport/+bug/2028666/+attachment/5688515/+files/0002-debian-remove-magic-stderr.patch
2023-07-26 07:34:15 Dariusz Gadomski bug added subscriber Dariusz Gadomski
2023-07-26 08:14:58 Ubuntu Foundations Team Bug Bot tags patch
2023-08-03 19:37:24 Andreas Hasenack sosreport (Ubuntu Focal): status New Fix Committed
2023-08-03 19:37:25 Andreas Hasenack bug added subscriber Ubuntu Stable Release Updates Team
2023-08-03 19:37:27 Andreas Hasenack bug added subscriber SRU Verification
2023-08-03 19:37:32 Andreas Hasenack tags patch patch verification-needed verification-needed-focal
2023-08-04 03:29:00 nikhil kshirsagar sosreport (Ubuntu Focal): assignee nikhil kshirsagar (nkshirsagar)
2023-08-17 13:05:10 nikhil kshirsagar tags patch verification-needed verification-needed-focal patch verification-done verification-done-focal
2023-08-17 14:27:35 Launchpad Janitor sosreport (Ubuntu Focal): status Fix Committed Fix Released
2023-08-17 14:27:40 Andreas Hasenack removed subscriber Ubuntu Stable Release Updates Team