Blame SOURCES/sos-bz1905657-empty-file-stops-zero-sizelimit.patch

f2c821
From c2ddb50fbbb045daffa6fe5cf489fe47aeef4590 Mon Sep 17 00:00:00 2001
f2c821
From: Jake Hunsaker <jhunsake@redhat.com>
f2c821
Date: Wed, 9 Dec 2020 10:21:32 -0500
f2c821
Subject: [PATCH] [options] Fix --log-size=0 being ignored and unreported
f2c821
 otherwise
f2c821
f2c821
The `--log-size` option was being silently ignored, due to a too-loose
f2c821
conditional in `Component.apply_options_from_cmdline()` which was
f2c821
inadvertently filtering out the option when a user set it to 0. Note
f2c821
that this did not affect `sos.conf` settings for this same value.
f2c821
f2c821
Similarly, reporting the effective options after preset and cmdline
f2c821
merging was skipping log-size when it was set to 0, since we normally
f2c821
want to filter out null-value options (which imply they were not
f2c821
invoked). Adding an explicit check for `log-size` here is the easiest
f2c821
route forward to allow the reporting we expect.
f2c821
f2c821
Closes: #2334
f2c821
Resolves: #2335
f2c821
f2c821
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
f2c821
---
f2c821
 sos/component.py | 2 +-
f2c821
 sos/options.py   | 3 +++
f2c821
 2 files changed, 4 insertions(+), 1 deletion(-)
f2c821
f2c821
diff --git a/sos/component.py b/sos/component.py
f2c821
index 00f27f5e..69d3b755 100644
f2c821
--- a/sos/component.py
f2c821
+++ b/sos/component.py
f2c821
@@ -192,7 +192,7 @@ class SoSComponent():
f2c821
         for opt, val in codict.items():
f2c821
             if opt not in cmdopts.arg_defaults.keys():
f2c821
                 continue
f2c821
-            if val and val != opts.arg_defaults[opt]:
f2c821
+            if val is not None and val != opts.arg_defaults[opt]:
f2c821
                 setattr(opts, opt, val)
f2c821
 
f2c821
         return opts
f2c821
diff --git a/sos/options.py b/sos/options.py
f2c821
index ba3db130..b82a7d36 100644
f2c821
--- a/sos/options.py
f2c821
+++ b/sos/options.py
f2c821
@@ -282,6 +282,9 @@ class SoSOptions():
f2c821
             """
f2c821
             if name in ("add_preset", "del_preset", "desc", "note"):
f2c821
                 return False
f2c821
+            # Exception list for options that still need to be reported when 0
f2c821
+            if name in ['log_size', 'plugin_timeout'] and value == 0:
f2c821
+                return True
f2c821
             return has_value(name, value)
f2c821
 
f2c821
         def argify(name, value):
f2c821
-- 
f2c821
2.26.2
f2c821