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

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