Blame SOURCES/sos-bz1985986-potential-issues-static-analyse.patch

bf10fb
From 6d5cbe90e17534d53d7fe42dff4d8ca734acf594 Mon Sep 17 00:00:00 2001
bf10fb
From: Jake Hunsaker <jhunsake@redhat.com>
bf10fb
Date: Tue, 29 Jun 2021 15:49:00 -0400
bf10fb
Subject: [PATCH] [yum] Fix potential traceback when yum history is empty
bf10fb
bf10fb
Like we did in #969 for `dnf`, fix a potential issue where we would
bf10fb
generate a traceback in the plugin when `yum history` is empty.
bf10fb
bf10fb
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
bf10fb
---
bf10fb
 sos/report/plugins/yum.py | 2 +-
bf10fb
 1 file changed, 1 insertion(+), 1 deletion(-)
bf10fb
bf10fb
diff --git a/sos/report/plugins/yum.py b/sos/report/plugins/yum.py
bf10fb
index 54e222df..aec805e6 100644
bf10fb
--- a/sos/report/plugins/yum.py
bf10fb
+++ b/sos/report/plugins/yum.py
bf10fb
@@ -91,7 +91,7 @@ class Yum(Plugin, RedHatPlugin):
bf10fb
         # packages installed/erased/updated per transaction
bf10fb
         if self.get_option("yum-history-info"):
bf10fb
             history = self.exec_cmd("yum history")
bf10fb
-            transactions = None
bf10fb
+            transactions = -1
bf10fb
             if history['status'] == 0:
bf10fb
                 for line in history['output'].splitlines():
bf10fb
                     try:
bf10fb
-- 
bf10fb
2.31.1
bf10fb
bf10fb
From a7a4ef73faee6cddba36bf670d4a20ab0521c36f Mon Sep 17 00:00:00 2001
bf10fb
From: Pavel Moravec <pmoravec@redhat.com>
bf10fb
Date: Wed, 30 Jun 2021 13:10:56 +0200
bf10fb
Subject: [PATCH] [plugins] Set default predicate instead of None for
bf10fb
 robustness
bf10fb
bf10fb
Just making the code more robustness, it could be dangerous to
bf10fb
set pred = None and then potentially call log_skipped_cmd that
bf10fb
expects "pred" of SoSPredicate type.
bf10fb
bf10fb
Currently such a call flow can not happen, but it is worth to
bf10fb
make the code more robust for potential future changes.
bf10fb
bf10fb
Resolves: #2601
bf10fb
bf10fb
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
bf10fb
---
bf10fb
 sos/report/plugins/__init__.py | 2 +-
bf10fb
 1 file changed, 1 insertion(+), 1 deletion(-)
bf10fb
bf10fb
diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py
bf10fb
index 6fd1a3b2..b9cd28ed 100644
bf10fb
--- a/sos/report/plugins/__init__.py
bf10fb
+++ b/sos/report/plugins/__init__.py
bf10fb
@@ -1629,7 +1629,7 @@ class Plugin(object):
bf10fb
 
bf10fb
     def _add_cmd_output(self, **kwargs):
bf10fb
         """Internal helper to add a single command to the collection list."""
bf10fb
-        pred = kwargs.pop('pred') if 'pred' in kwargs else None
bf10fb
+        pred = kwargs.pop('pred') if 'pred' in kwargs else SoSPredicate(self)
bf10fb
         soscmd = SoSCommand(**kwargs)
bf10fb
         self._log_debug("packed command: " + soscmd.__str__())
bf10fb
         for _skip_cmd in self.skip_commands:
bf10fb
-- 
bf10fb
2.31.1
bf10fb