Accepting request 223233 from Printing

In any case cups.socket and cups.path are stopped and disabled now because cautious clean up would leave a messsed up systemd setup for cupsd when YaST was used before (bnc#857372) plus CUPS upstream fix for STR #4351 cups-lpd hugh jobs (>2G) fail (bnc#864782) (forwarded request 223231 from jsmeix)

OBS-URL: https://build.opensuse.org/request/show/223233
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cups?expand=0&rev=117
This commit is contained in:
Stephan Kulow 2014-02-22 19:44:27 +00:00 committed by Git OBS Bridge
commit 9f64fd3f8c
3 changed files with 139 additions and 8 deletions

View File

@ -1,3 +1,36 @@
-------------------------------------------------------------------
Thu Feb 20 13:57:24 CET 2014 - jsmeix@suse.de
- Cautious clean up of systemd units via RPM scriptlets
(see the entry below dated "Wed Feb 19 15:05:44 CET 2014")
does not work reliable because it would leave a messsed up
systemd setup for cupsd when YaST was used before
to start/stop/enable/disable the cupsd, see
https://bugzilla.novell.com/show_bug.cgi?id=857372#c115
so that now cups.socket and cups.path are stopped and disabled
in any case to ensure starting/stopping/enabling/disabling
of the cupsd also works with YaST, see
https://bugzilla.novell.com/show_bug.cgi?id=857372#c120
(bnc#857372).
- str4351.patch from CUPS upstream fixes
https://www.cups.org/str.php?L4351
"STR #4351 cups-lpd hugh jobs (>2G) fail"
(bnc#864782).
-------------------------------------------------------------------
Wed Feb 19 15:05:44 CET 2014 - jsmeix@suse.de
- Cautious clean up of systemd units via RPM scriptlets:
* When /usr/lib/systemd/system/cups.path and/or
/usr/lib/systemd/system/cups.socket are in use
stop and disable them because they are no longer provided
but keep manually set up cups.path and/or cups.socket units.
* Enforce systemd to use the cups.service file in this package
by "systemctl reenable cups.service" if it was enabled
(intentionally this does not restart a running cupsd).
For details see "rpm -q --scripts cups" and have a look at
http://lists.opensuse.org/opensuse-packaging/2014-02/msg00096.html
-------------------------------------------------------------------
Wed Feb 12 11:53:45 CET 2014 - jsmeix@suse.de

View File

@ -41,13 +41,6 @@ BuildRequires: openslp-devel
BuildRequires: openssl-devel
BuildRequires: pam-devel
BuildRequires: pkgconfig
%if 0%{?suse_version} > 1140
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
%define have_systemd 1
# may not be defined in older systemd macros..
%{!?_tmpfilesdir: %global _tmpfilesdir /usr/lib/tmpfiles.d }
%endif
# The "BuildRequires: poppler-tools" installs /usr/bin/pdftops for the
# check in config-scripts/cups-pdf.m4 regarding HAVE_PDFTOPS_WITH_ORIGPAGESIZE
# see https://www.cups.org/str.php?L3689
@ -61,8 +54,35 @@ BuildRequires: poppler-tools
BuildRequires: tcpd-devel
BuildRequires: update-desktop-files
BuildRequires: zlib-devel
# See http://en.opensuse.org/openSUSE:Systemd_packaging_guidelines
# that reads as of this writing (Thu Feb 13 12:20:32 CET 2014)
# where here the RPM macro percentage sign is replaced with '@' to be safe:
# Starting with openSUSE 12.1, several RPM macros
# must be used to package systemd services files
# Build Requirement
# You should add :
# @if 0@{?suse_version} >= 1210
# BuildRequires: systemd
# @endif
# as Build Requires.
# Requires
# Add
# @{?systemd_requires}
# to ensure the needed dependencies are added to your package
%if 0%{?suse_version} >= 1210
%define have_systemd 1
%endif
%if 0%{?have_systemd}
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
# _tmpfilesdir is not defined in systemd macros up to openSUSE 12.3 and
# in openSUSE 13.1 "rpm --eval @{_tmpfilesdir}" results /usr/lib/tmpfiles.d
# (above the RPM macro percentage sign is replaced with '@' to be safe):
%{!?_tmpfilesdir: %global _tmpfilesdir /usr/lib/tmpfiles.d }
%else
PreReq: %insserv_prereq
PreReq: %fillup_prereq
%endif
# sysvinit(syslog) is first provided in openSUSE:Factory (i.e. openSUSE 11.4):
%if 0%{?suse_version} > 1130
PreReq: sysvinit(syslog)
@ -196,6 +216,8 @@ Patch112: cups-0003-systemd-secure-cups.service-unit-file.patch
# who have been allowed by root to do CUPS configuration changes
# (CUPS STR#4223 CVE-2012-5519 Novell/Suse Bugzilla bnc#789566):
Patch113: cups-1.5.4-CVE-2012-5519.patch
# Patch114 fixes STR #4351: cups-lpd hugh jobs (>2G) fail
Patch114: str4351.patch
# Install into this non-root directory (required when norootforbuild is used):
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -356,6 +378,8 @@ printer drivers for CUPS.
# who have been allowed by root to do CUPS configuration changes
# (CUPS STR#4223 CVE-2012-5519 Novell/Suse Bugzilla bnc#789566):
%patch113
# Patch114 fixes STR #4351: cups-lpd hugh jobs (>2G) fail
%patch114
%build
# Disable SILENT run of make so that make runs verbose as usual:
@ -514,6 +538,13 @@ ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rccups
%else
ln -s /sbin/service %{buildroot}%{_sbindir}/rccups
%endif
# For information only:
# When cupsd is launched via systemd there must no longer be any /etc/init.d/cups script
# (e.g. as an attempt to provide backward compatibility e.g. via "exec /usr/sbin/rccups $@")
# because systemd would recognize /etc/init.d/cups as another way to launch cupsd
# in addition to the actual unit file /usr/lib/systemd/system/cups.service
# which means calling "/etc/init.d/cups [start|stop|status]" does no longer work,
# see http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities/
# End launch cupsd via systemd
%else
# Begin launch cupsd via SysVinit:
@ -546,12 +577,35 @@ sed -i -e 's|/var/lock|/run/lock|g' %{buildroot}/etc/init.d/cups
# Use a real bash script with an explicit "exit 0" at the end to be by default fail safe
# an explicit "exit 1" must be use to enforce package install/upgrade/erase failure where needed
# see the "Shared_libraries" section in http://en.opensuse.org/openSUSE:Packaging_scriptlet_snippets
/usr/sbin/groupadd -g 71 -o -r ntadmin 2>/dev/null || :
%if 0%{?have_systemd}
# Cleaning up obsolete systemd units cups.path and cups.socket is only needed up to openSUSE 13.1
# because cups.path and cups.socket are only provided from openSUSE 12.2 up to openSUSE 13.1
# see bnc#857372 starting at https://bugzilla.novell.com/show_bug.cgi?id=857372#c61
%if 0%{?suse_version} <= 1310
# Begin clean up obsolete systemd units cups.path and cups.socket
# Stop and disable systemd units that have been provided by a previous package version but are no longer provided by this package.
# Do this in any case because YaST only supprts cups.service but not cups.socket or cups.path
# see https://bugzilla.novell.com/show_bug.cgi?id=857372#c120
# and if cups.socket or cups.path would be actuve YaST would mess up the systemd setup for CUPS
# see https://bugzilla.novell.com/show_bug.cgi?id=857372#c115
# which is one more reason that cups.socket and cups.path are completely disabled and removed
# see https://bugzilla.novell.com/show_bug.cgi?id=857372#c61
for u in cups.path cups.socket
do # (without "|| :" build fails with "Failed to get D-Bus connection: No connection to service manager. preinstall script ... failed"):
systemctl --quiet stop $u || :
systemctl --quiet disable $u || :
done
# End clean up obsolete systemd units cups.path and cups.socket
%endif
# Begin service_add_pre cups.service
%service_add_pre cups.service
# End service_add_pre cups.service
%endif
# See https://bugzilla.novell.com/show_bug.cgi?id=suse45719
# and attr(0775,root,ntadmin) for /usr/share/cups/drivers/ in the files section below
# and the samba.spec file in openSUSE:13.1 for the used command there to be in sync with Samba
# (without "|| :" build fails on SLE_11 and SLE_11_SP1 with "build_patchrpmcheck_scr: line 7: groupadd: command not found"):
getent group ntadmin >/dev/null || groupadd -g 71 -o -r ntadmin || :
exit 0
%post
@ -562,6 +616,14 @@ exit 0
# Begin service_add_post cups.service
%service_add_post cups.service
# End service_add_post cups.service
# Begin refresh systemd unit cups.service
# Be on the safe side and enforce systemd to use the cups.service file in this package
# ("reenable" does not implicitly stop a running cupsd which is exactly correct here):
if systemctl --quiet is-enabled cups.service
then # (without "|| :" build fails with "Failed to get D-Bus connection: No connection to service manager. postinstall script ... failed"):
systemctl --quiet reenable cups.service || :
fi
# End refresh systemd unit cups.service
%else
# Begin fillup_and_insserv -ny cups cups
%{fillup_and_insserv -ny cups cups}

36
str4351.patch Normal file
View File

@ -0,0 +1,36 @@
Index: scheduler/cups-lpd.c
===================================================================
--- scheduler/cups-lpd.c (revision 11557)
+++ scheduler/cups-lpd.c (revision 11558)
@@ -781,7 +770,8 @@
int fd; /* Temporary file */
FILE *fp; /* File pointer */
char filename[1024]; /* Temporary filename */
- int bytes; /* Bytes received */
+ ssize_t bytes; /* Bytes received */
+ size_t total; /* Total bytes */
char line[256], /* Line from file/stdin */
command, /* Command from line */
*count, /* Number of bytes */
@@ -965,15 +955,15 @@
* Copy the data or control file from the client...
*/
- for (i = atoi(count); i > 0; i -= bytes)
+ for (total = (size_t)strtoll(count, NULL, 10); total > 0; total -= (size_t)bytes)
{
- if (i > sizeof(line))
- bytes = sizeof(line);
+ if (total > sizeof(line))
+ bytes = (ssize_t)sizeof(line);
else
- bytes = i;
+ bytes = (ssize_t)total;
- if ((bytes = fread(line, 1, bytes, stdin)) > 0)
- bytes = write(fd, line, bytes);
+ if ((bytes = (ssize_t)fread(line, 1, (size_t)bytes, stdin)) > 0)
+ bytes = write(fd, line, (size_t)bytes);
if (bytes < 1)
{