Bug#915724: cups: MaxJobTime=0 results in jobs being cancelled immediately instead of never
Package: cups
Version: 2.2.9-3
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu disco ubuntu-patch
Dear Maintainer,
Setting the cupsd option MaxJobTime to 0 should make the server wait
indefinitely for the job to be ready for print. Instead, after
updating job-cancel-after option with MaxJobTime=0 value it results
in immediate cancelling.
In Ubuntu, the attached patch was applied to achieve the following:
[ Dariusz Gadomski ]
* Fix handling of MaxJobTime 0 (LP: #1804576)
Thanks for considering the patch.
-- System Information:
Debian Release: buster/sid
APT prefers cosmic-updates
APT policy: (500, 'cosmic-updates'), (500, 'cosmic-security'), (500, 'cosmic'), (100, 'cosmic-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.18.0-11-generic (SMP w/24 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru cups-2.2.9/debian/patches/fix-handling-of-MaxJobTime.patch cups-2.2.9/debian/patches/fix-handling-of-MaxJobTime.patch
--- cups-2.2.9/debian/patches/fix-handling-of-MaxJobTime.patch 1969-12-31 19:00:00.000000000 -0500
+++ cups-2.2.9/debian/patches/fix-handling-of-MaxJobTime.patch 2018-12-06 03:14:58.000000000 -0500
@@ -0,0 +1,36 @@
+Description: Fix handling of MaxJobTime 0
+ Setting MaxJobTime to 0 resulted in immediate job cancellation
+ instead of disabling timeout-based cancelation (as per documentation).
+ .
+ cups (2.2.9-3ubuntu1) disco; urgency=medium
+ .
+ * Fix handling of MaxJobTime 0 (LP: #1804576)
+Origin: upstream, https://github.com/apple/cups/commit/8c7143551ab03423990c62923209363d760f925f
+Bug: https://github.com/apple/cups/issues/5438
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1804576
+
+--- cups-2.2.9.orig/scheduler/job.c
++++ cups-2.2.9/scheduler/job.c
+@@ -5130,8 +5130,10 @@ update_job(cupsd_job_t *job) /* I - Job
+
+ if (cancel_after)
+ job->cancel_time = time(NULL) + ippGetInteger(cancel_after, 0);
+- else
++ else if (MaxJobTime > 0)
+ job->cancel_time = time(NULL) + MaxJobTime;
++ else
++ job->cancel_time = 0;
+ }
+ }
+ }
+--- cups-2.2.9.orig/scheduler/printers.c
++++ cups-2.2.9/scheduler/printers.c
+@@ -3445,7 +3445,7 @@ add_printer_defaults(cupsd_printer_t *p)
+ "document-format-default", NULL, "application/octet-stream");
+
+ if (!cupsGetOption("job-cancel-after", p->num_options, p->options))
+- ippAddInteger(p->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
++ ippAddInteger(p->attrs, IPP_TAG_PRINTER, MaxJobTime > 0 ? IPP_TAG_INTEGER : IPP_TAG_NOVALUE,
+ "job-cancel-after-default", MaxJobTime);
+
+ if (!cupsGetOption("job-hold-until", p->num_options, p->options))
diff -Nru cups-2.2.9/debian/patches/series cups-2.2.9/debian/patches/series
--- cups-2.2.9/debian/patches/series 2018-12-05 16:45:00.000000000 -0500
+++ cups-2.2.9/debian/patches/series 2018-12-06 03:14:58.000000000 -0500
@@ -38,3 +38,4 @@
0038-The-lp-and-lpr-commands-now-provide-better-error-mes.patch
0039-Fix-E-option-Issue-5440.patch
manpage-translations.patch
+fix-handling-of-MaxJobTime.patch
Reply to: