rebase utf-8 fix patches onto 9.3 upstream package

This commit is contained in:
Jonathan Wright 2023-12-14 14:39:58 -06:00
parent 1fcea0bdd3
commit 8800ef1e1d
2 changed files with 15 additions and 25 deletions

View File

@ -1,16 +1,11 @@
From 7860463eb5ccc844f1d580edd7f12496fb6923b3 Mon Sep 17 00:00:00 2001
From: Jonathan Wright <jonathan@almalinux.org>
Date: Mon, 14 Aug 2023 09:55:12 -0500
Subject: [PATCH] fixes error with handling invalid utf-8 chars in
needs-restarting
commit 51956e55c23a7f4a60e80922edea71cfbca73a6b
Author: Jonathan Wright <jonathan@almalinux.org>
Date: Thu Dec 14 14:24:44 2023 -0600
---
plugins/needs_restarting.py | 2 +-
tests/test_needs_restarting.py | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
fix utf-8 issue
diff --git a/plugins/needs_restarting.py b/plugins/needs_restarting.py
index 1fedb73..d8ab0bc 100644
index 63d5a1e..61542c7 100644
--- a/plugins/needs_restarting.py
+++ b/plugins/needs_restarting.py
@@ -73,7 +73,7 @@ def list_opened_files(uid):
@ -23,7 +18,7 @@ index 1fedb73..d8ab0bc 100644
except EnvironmentError:
logger.warning("Failed to read PID %d's smaps.", pid)
diff --git a/tests/test_needs_restarting.py b/tests/test_needs_restarting.py
index 0ad70a5..c021e06 100644
index 7b629b4..c365292 100644
--- a/tests/test_needs_restarting.py
+++ b/tests/test_needs_restarting.py
@@ -1,3 +1,4 @@
@ -31,21 +26,18 @@ index 0ad70a5..c021e06 100644
# Copyright (C) 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
@@ -20,8 +21,10 @@ from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
+from unittest.mock import patch
@@ -24,6 +25,7 @@ from unittest.mock import patch, Mock
import dbus
import needs_restarting
import tests.support
+import tempfile
DEL_FILE = '3dcf000000-3dcf032000 r-xp 00000000 08:02 140759 ' \
' /usr/lib64/libXfont.so.1.4.1;5408628d (deleted)'
@@ -46,6 +49,16 @@ class NeedsRestartingTest(tests.support.TestCase):
self.assertTrue(ofile.deleted)
self.assertEqual(ofile.name, '/usr/lib64/libXfont.so.1.4.1;5408628d')
@@ -58,6 +60,16 @@ class NeedsRestartingTest(tests.support.TestCase):
patch( "dbus.bus.BusConnection.__new__", side_effect=dbus.DBusException("Never should hit this exception if mock above works")):
self.assertIsNone(func(1234))
+ def test_list_opened_files_garbage_filename(self):
+ tempObj = tempfile.NamedTemporaryFile()
+ tempFile = tempObj.name
@ -56,8 +48,6 @@ index 0ad70a5..c021e06 100644
+ ofiles = list(needs_restarting.list_opened_files(None));
+ self.assertEqual(ofiles[0].presumed_name, '/usr/lib64/lib<69>Evil-13.37.so')
+
class OpenedFileTest(tests.support.TestCase):
def test_presumed_name(self):
--
2.41.0
ofile = needs_restarting.OpenedFile(

View File

@ -798,7 +798,7 @@ ln -sf %{_mandir}/man1/%{yum_utils_subpackage_name}.1.gz %{buildroot}%{_mandir}/
%endif
%changelog
* Mon Dec 14 2023 Jonathan Wright <jonathan@almalinux.org> - 4.3.0-11.alma.1
* Thu Dec 14 2023 Jonathan Wright <jonathan@almalinux.org> - 4.3.0-11.alma.1
- Resolves rhbz#2231923 - Smaps file parsing in DNF's needs-restarting cannot handle garbage UTF-8-ish characters in smaps lines
* Fri Sep 08 2023 Marek Blaha <mblaha@redhat.com> - 4.3.0-11