Compare commits
1 Commits
9690994bc3
...
6ac15e99f4
Author | SHA1 | Date |
---|---|---|
Jonathan Wright | 6ac15e99f4 |
|
@ -1,23 +1,19 @@
|
|||
From 50ffed7d4750b9fe9d5dcf5b2fd77fefd636cb97 Mon Sep 17 00:00:00 2001
|
||||
From: Andy Baugh <thomas.baugh@cpanel.net>
|
||||
Date: Tue, 6 Jun 2023 16:37:42 +0000
|
||||
Subject: [PATCH] Fix for strange issue with binary garbage in smaps files
|
||||
From 6539ae56dc5993bfb0a72fed97a7f7fda2c3ce61 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
|
||||
|
||||
= changelog =
|
||||
msg: Avoid issue with garbage smaps chars in needs-restarting.py
|
||||
type: bugfix
|
||||
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2212953
|
||||
related: None
|
||||
---
|
||||
plugins/needs_restarting.py | 2 +-
|
||||
tests/test_needs_restarting.py | 14 +++++++++++++-
|
||||
2 files changed, 14 insertions(+), 2 deletions(-)
|
||||
tests/test_needs_restarting.py | 12 ++++++++++++
|
||||
2 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/plugins/needs_restarting.py b/plugins/needs_restarting.py
|
||||
index a3a5f12d..0c7f8a2f 100644
|
||||
index 1fedb73..d8ab0bc 100644
|
||||
--- a/plugins/needs_restarting.py
|
||||
+++ b/plugins/needs_restarting.py
|
||||
@@ -74,7 +74,7 @@ def list_opened_files(uid):
|
||||
@@ -73,7 +73,7 @@ def list_opened_files(uid):
|
||||
try:
|
||||
if uid is not None and uid != owner_uid(smaps):
|
||||
continue
|
||||
|
@ -27,7 +23,7 @@ index a3a5f12d..0c7f8a2f 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 7b629b47..d7dd6d5a 100644
|
||||
index 0ad70a5..5bfcc4d 100644
|
||||
--- a/tests/test_needs_restarting.py
|
||||
+++ b/tests/test_needs_restarting.py
|
||||
@@ -1,3 +1,4 @@
|
||||
|
@ -35,26 +31,18 @@ index 7b629b47..d7dd6d5a 100644
|
|||
# Copyright (C) 2014 Red Hat, Inc.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing to use,
|
||||
@@ -15,7 +16,6 @@
|
||||
# Red Hat, Inc.
|
||||
#
|
||||
|
||||
-
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
@@ -24,6 +24,7 @@
|
||||
import dbus
|
||||
@@ -22,6 +23,7 @@ from __future__ import unicode_literals
|
||||
|
||||
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)'
|
||||
@@ -58,6 +59,17 @@ def test_get_service_dbus_nounitforpid(self):
|
||||
patch( "dbus.bus.BusConnection.__new__", side_effect=dbus.DBusException("Never should hit this exception if mock above works")):
|
||||
self.assertIsNone(func(1234))
|
||||
|
||||
@@ -46,6 +48,16 @@ class NeedsRestartingTest(tests.support.TestCase):
|
||||
self.assertTrue(ofile.deleted)
|
||||
self.assertEqual(ofile.name, '/usr/lib64/libXfont.so.1.4.1;5408628d')
|
||||
|
||||
+ def test_list_opened_files_garbage_filename(self):
|
||||
+ tempObj = tempfile.NamedTemporaryFile()
|
||||
+ tempFile = tempObj.name
|
||||
|
@ -65,7 +53,8 @@ index 7b629b47..d7dd6d5a 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):
|
||||
ofile = needs_restarting.OpenedFile(
|
||||
--
|
||||
2.41.0
|
||||
|
|
Loading…
Reference in New Issue