This commit is contained in:
Zdenek Dohnal 2020-11-05 12:14:34 +01:00
parent 158b07c1fd
commit a43581a02b
7 changed files with 14 additions and 266 deletions

1
.gitignore vendored
View File

@ -260,3 +260,4 @@ pycups-1.9.51.tar.bz2
/system-config-printer-1.5.9.tar.gz
/system-config-printer-1.5.11.tar.gz
/system-config-printer-1.5.12.tar.gz
/system-config-printer-1.5.13.tar.xz

View File

@ -1,48 +0,0 @@
From cf7a74217558b19aff7c21a724878bcc15dc4e38 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Mon, 5 Oct 2020 09:26:40 +0200
Subject: [PATCH] isAlive() is removed, use is_alive()
---
asyncipp.py | 2 +-
timedops.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/asyncipp.py b/asyncipp.py
index 5bc160e0..61cd7213 100644
--- a/asyncipp.py
+++ b/asyncipp.py
@@ -269,7 +269,7 @@ class IPPConnection:
for binding in self.bindings:
delattr (self, binding)
- if self.thread.isAlive ():
+ if self.thread.is_alive ():
debugprint ("Stopping worker thread")
self.thread.stop ()
GLib.timeout_add_seconds (1, self._reap_thread)
diff --git a/timedops.py b/timedops.py
index 8a8741c8..111d575f 100644
--- a/timedops.py
+++ b/timedops.py
@@ -157,7 +157,7 @@ class OperationThread(threading.Thread):
self.exception = e
def collect_result (self):
- if self.isAlive ():
+ if self.is_alive ():
# We've been canceled.
raise OperationCanceled()
@@ -212,7 +212,7 @@ class TimedOperation(Timed):
return self.thread.collect_result ()
def _check_thread (self):
- if self.thread.isAlive ():
+ if self.thread.is_alive ():
# Thread still running.
return True
--
2.26.2

View File

@ -1,71 +0,0 @@
diff --git a/NEWS b/NEWS
index f4b774e..0b53aa8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
1.5.13 changes
--------------
+- add checks for NULL in udev-configure-printer (Fedora #1761097)
1.5.12 changes
--------------
diff --git a/udev/udev-configure-printer.c b/udev/udev-configure-printer.c
index 83092fc..8f6ce3d 100644
--- a/udev/udev-configure-printer.c
+++ b/udev/udev-configure-printer.c
@@ -1285,7 +1285,8 @@ normalize_device_uri(const char *str_orig)
{
int i, j;
int havespace = 0;
- char *str;
+ char *str = NULL;
+ char *cropped_str = NULL;
if (str_orig == NULL)
return NULL;
@@ -1333,7 +1334,11 @@ normalize_device_uri(const char *str_orig)
(strstr(str, "packard ") == str) ||
(strstr(str, "apollo ") == str) ||
(strstr(str, "usb ") == str))
- str = strchr(str, ' ') + 1;
+ {
+ cropped_str = strdup(strchr(str, ' ') + 1);
+ free(str);
+ str = cropped_str;
+ }
return str;
}
@@ -1411,7 +1416,7 @@ for_each_matching_queue (struct device_uris *device_uris,
const char *printer_state_message = NULL;
int state = 0;
size_t i, l;
- char *this_device_uri_n, *device_uri_n;
+ char *this_device_uri_n = NULL, *device_uri_n = NULL;
const char *ps1, *ps2, *pi1, *pi2;
while (attr && ippGetGroupTag (attr) != IPP_TAG_PRINTER)
@@ -1507,13 +1512,21 @@ for_each_matching_queue (struct device_uris *device_uris,
break;
}
}
+ if (device_uri_n != NULL)
+ {
+ free(device_uri_n);
+ device_uri_n = NULL;
+ }
}
firstqueue = 0;
skip:
- free(device_uri_n);
- free(this_device_uri_n);
+ if (this_device_uri_n != NULL)
+ {
+ free(this_device_uri_n);
+ this_device_uri_n = NULL;
+ }
if (!attr)
break;
}

View File

@ -1 +1 @@
SHA512 (system-config-printer-1.5.12.tar.gz) = da7cbf913d3c33fb89c8e1b9a6a12b9ec133831bd89b2f28c771c4ecde697df0be975a45e92f30b2cd4562aafcf87f5d36a01c94d63c7c7107b72b0aecce3756
SHA512 (system-config-printer-1.5.13.tar.xz) = f4fbc1b20b35aa5b33bafdffc8a7490cc3c55e0b33bd9e925f1d3e01532c0a7bb87f80a04dd6da6fc492edd9fea74bacb0ce16ff64ceac622722fe1f9a77a6b7

View File

@ -1,135 +0,0 @@
diff --git a/cupshelpers/openprinting.py b/cupshelpers/openprinting.py
index c616d913..9bb4764c 100755
--- a/cupshelpers/openprinting.py
+++ b/cupshelpers/openprinting.py
@@ -338,7 +338,7 @@ class OpenPrinting:
packages = {}
container = driver.find ('packages')
if container is not None:
- for arch in container.getchildren ():
+ for arch in list(container):
rpms = {}
for package in arch.findall ('package'):
rpm = {}
@@ -351,7 +351,7 @@ class OpenPrinting:
repositories = package.find ('repositories')
if repositories is not None:
- for pkgsys in repositories.getchildren ():
+ for pkgsys in list(repositories):
rpm.setdefault('repositories', {})[pkgsys.tag] = pkgsys.text
rpms[package.attrib['file']] = rpm
@@ -363,7 +363,7 @@ class OpenPrinting:
ppds = []
container = driver.find ('ppds')
if container is not None:
- for each in container.getchildren ():
+ for each in list(container):
ppds.append (each.text)
if ppds:
diff --git a/cupshelpers/xmldriverprefs.py b/cupshelpers/xmldriverprefs.py
index 4177e1c0..0d02950f 100644
--- a/cupshelpers/xmldriverprefs.py
+++ b/cupshelpers/xmldriverprefs.py
@@ -27,7 +27,7 @@ from .cupshelpers import parseDeviceID
def PreferredDrivers (filename):
preferreddrivers = xml.etree.ElementTree.XML (open (filename).read ())
- return preferreddrivers.getchildren()
+ return list(preferreddrivers)
class DeviceIDMatch:
"""
@@ -227,10 +227,10 @@ class DriverTypes:
"""
types = []
- for drivertype in drivertypes.getchildren ():
+ for drivertype in list(drivertypes):
t = DriverType (drivertype.attrib["name"])
- for child in drivertype.getchildren ():
+ for child in list(drivertype):
if child.tag == "ppdname":
t.add_ppd_name (child.attrib["match"])
elif child.tag == "attribute":
@@ -238,7 +238,7 @@ class DriverTypes:
child.attrib["match"])
elif child.tag == "deviceid":
deviceid_match = DeviceIDMatch ()
- for field in child.getchildren ():
+ for field in list(child):
if field.tag == "field":
deviceid_match.add_field (field.attrib["name"],
field.attrib["match"])
@@ -414,29 +414,29 @@ class PreferenceOrder:
Load the policy from an XML file.
"""
- for printer in preferreddrivers.getchildren ():
+ for printer in list(preferreddrivers):
ptype = PrinterType ()
- for child in printer.getchildren ():
+ for child in list(printer):
if child.tag == "make-and-model":
ptype.add_make_and_model (child.attrib["match"])
elif child.tag == "deviceid":
deviceid_match = DeviceIDMatch ()
- for field in child.getchildren ():
+ for field in list(child):
if field.tag == "field":
deviceid_match.add_field (field.attrib["name"],
field.attrib["match"])
ptype.add_deviceid_match (deviceid_match)
elif child.tag == "drivers":
- for drivertype in child.getchildren ():
+ for drivertype in list(child):
ptype.add_drivertype_pattern (drivertype.text)
elif child.tag == "avoid":
- for drivertype in child.getchildren ():
+ for drivertype in list(child):
ptype.add_avoidtype_pattern (drivertype.text)
elif child.tag == "blacklist":
- for drivertype in child.getchildren ():
+ for drivertype in list(child):
ptype.add_blacklisted (drivertype.text)
self.ptypes.append (ptype)
diff --git a/xml/validate.py b/xml/validate.py
index 8fc201ec..ba16766d 100644
--- a/xml/validate.py
+++ b/xml/validate.py
@@ -35,23 +35,23 @@ class Validator:
filename = self._filename
print ("Validating %s" % filename)
preferreddrivers = xml.etree.ElementTree.XML (open (filename).read ())
- (drivertypes, preferenceorder) = preferreddrivers.getchildren ()
+ (drivertypes, preferenceorder) = list(preferreddrivers)
validates = True
names = set()
- for drivertype in drivertypes.getchildren ():
+ for drivertype in list(drivertypes):
name = drivertype.get ("name")
names.add (name)
- for printer in preferenceorder.getchildren ():
+ for printer in list(preferenceorder):
types = []
drivers = printer.find ("drivers")
if drivers is not None:
- types.extend (drivers.getchildren ())
+ types.extend (list(drivers))
blacklist = printer.find ("blacklist")
if blacklist is not None:
- types.extend (blacklist.getchildren ())
+ types.extend (list(blacklist))
for drivertype in types:
pattern = drivertype.text.strip ()

View File

@ -8,20 +8,22 @@
Summary: A printer administration tool
Name: system-config-printer
Version: 1.5.12
Release: 9%{?dist}
Version: 1.5.13
Release: 1%{?dist}
License: GPLv2+
URL: https://github.com/%{username}/%{name}
Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.gz
Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.xz
# all upstream patches, remove with new release
Patch01: 0001-udev-configure-printer-Add-checks-for-NULL.patch
Patch02: system-config-printer-getchildren-removed.patch
Patch03: 0001-isAlive-is-removed-use-is_alive.patch
# gcc is no longer in buildroot by default
# gcc is needed for udev-configure-printer.c
BuildRequires: gcc
# for autosetup
BuildRequires: git-core
# uses make
BuildRequires: make
BuildRequires: cups-devel >= 1.2
BuildRequires: desktop-file-utils >= 0.2.92
@ -87,11 +89,7 @@ The udev rules and helper programs for automatically configuring USB
printers.
%prep
%setup -q
# all backported from upstream
%patch01 -p1 -b .udev-configure-segfault
%patch02 -p1 -b .getchildren-removed
%patch03 -p1 -b .isAlive-removed
%autosetup -S git
%build
%configure --with-udev-rules
@ -217,6 +215,9 @@ touch %buildroot%{_localstatedir}/run/udev-configure-printer/usb-uris
exit 0
%changelog
* Thu Nov 05 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.5.13-1
- 1.15.13
* Mon Oct 05 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.5.12-9
- 1884866 - s-c-p: isAlive() is removed, use is_alive()