36 lines
1.2 KiB
Diff
36 lines
1.2 KiB
Diff
|
From 553a2c585db50599d5028ea6bb6462281bb88d02 Mon Sep 17 00:00:00 2001
|
||
|
From: Jaroslav Mracek <jmracek@redhat.com>
|
||
|
Date: Mon, 11 Jul 2022 12:27:14 +0200
|
||
|
Subject: [PATCH] Set default value for variable to prevent crash
|
||
|
(RhBug:2091636)
|
||
|
|
||
|
It ensure that read of file ended successfully.
|
||
|
|
||
|
https://bugzilla.redhat.com/show_bug.cgi?id=2091636
|
||
|
---
|
||
|
dnf/conf/substitutions.py | 4 +++-
|
||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/dnf/conf/substitutions.py b/dnf/conf/substitutions.py
|
||
|
index 703e4a4f..1281bdf0 100644
|
||
|
--- a/dnf/conf/substitutions.py
|
||
|
+++ b/dnf/conf/substitutions.py
|
||
|
@@ -53,6 +53,7 @@ class Substitutions(dict):
|
||
|
continue
|
||
|
for fsvar in fsvars:
|
||
|
filepath = os.path.join(dir_fsvars, fsvar)
|
||
|
+ val = None
|
||
|
if os.path.isfile(filepath):
|
||
|
try:
|
||
|
with open(filepath) as fp:
|
||
|
@@ -61,4 +62,5 @@ class Substitutions(dict):
|
||
|
val = val[:-1]
|
||
|
except (OSError, IOError):
|
||
|
continue
|
||
|
- self[fsvar] = val
|
||
|
+ if val is not None:
|
||
|
+ self[fsvar] = val
|
||
|
--
|
||
|
2.37.1
|
||
|
|