Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

I hereby request an upload authorization towards an unblock for package cups
2.2.10-6; which was not uploaded yet.

  cups (2.2.10-6) unstable; urgency=medium

    * Backport patch from upstream's 2.2 "stable" branch:
      - Fix an issue with `PreserveJobHistory` and time values (Issue #5538)
        (Closes: #921741)

The `PreserveJobHistory` configuration doesn't work correctly in 2.2.10, and
this was fixed by upstream in 2.2.11; this upload has only a cherry-pick of
upstream's ba9d68cc7467a7a47ef219071902b9e9eb6dbc44 and would fix src:cups bug
#921741.

Both the concrete upstream diff and the full debdiff are attached.

Thanks for your consideration, cheers,
        OdyX

unblock cups/2.2.10-6
diff -Nru cups-2.2.10/debian/changelog cups-2.2.10/debian/changelog
--- cups-2.2.10/debian/changelog        2019-03-27 17:13:07.000000000 +0100
+++ cups-2.2.10/debian/changelog        2019-04-23 08:33:01.000000000 +0200
@@ -1,3 +1,11 @@
+cups (2.2.10-6) unstable; urgency=medium
+
+  * Backport patch from upstream's 2.2 "stable" branch:
+    - Fix an issue with `PreserveJobHistory` and time values (Issue #5538)
+      (Closes: #921741)
+
+ -- Didier Raboud <o...@debian.org>  Tue, 23 Apr 2019 08:33:01 +0200
+
 cups (2.2.10-5) unstable; urgency=medium
 
   [ Helge Kreutzmann ]
diff -Nru cups-2.2.10/debian/.git-dpm cups-2.2.10/debian/.git-dpm
--- cups-2.2.10/debian/.git-dpm 2019-03-27 17:13:07.000000000 +0100
+++ cups-2.2.10/debian/.git-dpm 2019-04-23 08:33:01.000000000 +0200
@@ -1,6 +1,6 @@
 # see git-dpm(1) from git-dpm package
-2fb6d0075ed13f2fd03a8600a6ecb0892818116b
-2fb6d0075ed13f2fd03a8600a6ecb0892818116b
+9615ef5f2b8374bfe2816f8ff4314234362ce841
+9615ef5f2b8374bfe2816f8ff4314234362ce841
 25b2338346ef3abbb93ea88476887cba7b2b86f8
 25b2338346ef3abbb93ea88476887cba7b2b86f8
 cups_2.2.10.orig.tar.gz
diff -Nru 
cups-2.2.10/debian/patches/0045-Fix-an-issue-with-PreserveJobHistory-and-time-values.patch
 
cups-2.2.10/debian/patches/0045-Fix-an-issue-with-PreserveJobHistory-and-time-values.patch
--- 
cups-2.2.10/debian/patches/0045-Fix-an-issue-with-PreserveJobHistory-and-time-values.patch
  1970-01-01 01:00:00.000000000 +0100
+++ 
cups-2.2.10/debian/patches/0045-Fix-an-issue-with-PreserveJobHistory-and-time-values.patch
  2019-04-23 08:33:01.000000000 +0200
@@ -0,0 +1,114 @@
+From 917e6f4ff70eed933c80d21eed4c6bfeb2cb68b7 Mon Sep 17 00:00:00 2001
+From: Michael R Sweet <michael.r.sw...@gmail.com>
+Date: Mon, 11 Mar 2019 13:54:46 -0400
+Subject: Fix an issue with `PreserveJobHistory` and time values (Issue #5538)
+
+Closes: #921741
+---
+ scheduler/job.c | 36 ++++++++++++++++++------------------
+ 1 file changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/scheduler/job.c b/scheduler/job.c
+index cc9283fb8..d4793cbb1 100644
+--- a/scheduler/job.c
++++ b/scheduler/job.c
+@@ -437,10 +437,20 @@ cupsdCleanJobs(void)
+   curtime          = time(NULL);
+   JobHistoryUpdate = 0;
+ 
++  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCleanJobs: curtime=%d", 
(int)curtime);
++
+   for (job = (cupsd_job_t *)cupsArrayFirst(Jobs);
+        job;
+        job = (cupsd_job_t *)cupsArrayNext(Jobs))
+   {
++    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCleanJobs: Job %d, state=%d, 
printer=%p, history_time=%d, file_time=%d", job->id, (int)job->state_value, 
(void *)job->printer, (int)job->history_time, (int)job->file_time);
++
++    if ((job->history_time && job->history_time) < JobHistoryUpdate || 
!JobHistoryUpdate)
++      JobHistoryUpdate = job->history_time;
++
++    if ((job->file_time && job->file_time < JobHistoryUpdate) || 
!JobHistoryUpdate)
++      JobHistoryUpdate = job->file_time;
++
+     if (job->state_value >= IPP_JOB_CANCELED && !job->printer)
+     {
+      /*
+@@ -456,21 +466,9 @@ cupsdCleanJobs(void)
+       else if (job->file_time && job->file_time <= curtime)
+       {
+         cupsdLogJob(job, CUPSD_LOG_DEBUG, "Removing document files.");
+-        cupsdLogJob(job, CUPSD_LOG_DEBUG2, "curtime=%ld, job->file_time=%ld", 
(long)curtime, (long)job->file_time);
+         remove_job_files(job);
+ 
+         cupsdMarkDirty(CUPSD_DIRTY_JOBS);
+-
+-        if (job->history_time < JobHistoryUpdate || !JobHistoryUpdate)
+-        JobHistoryUpdate = job->history_time;
+-      }
+-      else
+-      {
+-        if (job->history_time < JobHistoryUpdate || !JobHistoryUpdate)
+-        JobHistoryUpdate = job->history_time;
+-
+-      if (job->file_time < JobHistoryUpdate || !JobHistoryUpdate)
+-        JobHistoryUpdate = job->file_time;
+       }
+     }
+   }
+@@ -1729,7 +1727,7 @@ cupsdLoadJob(cupsd_job_t *job)           /* I - Job */
+     job->completed_time = attr->values[0].integer;
+ 
+     if (JobHistory < INT_MAX)
+-      job->history_time = attr->values[0].integer + JobHistory;
++      job->history_time = job->completed_time + JobHistory;
+     else
+       job->history_time = INT_MAX;
+ 
+@@ -1740,7 +1738,7 @@ cupsdLoadJob(cupsd_job_t *job)           /* I - Job */
+       JobHistoryUpdate = job->history_time;
+ 
+     if (JobFiles < INT_MAX)
+-      job->file_time = attr->values[0].integer + JobFiles;
++      job->file_time = job->completed_time + JobFiles;
+     else
+       job->file_time = INT_MAX;
+ 
+@@ -2862,8 +2860,10 @@ cupsdUpdateJobs(void)
+       * Update history/file expiration times...
+       */
+ 
++      job->completed_time = attr->values[0].integer;
++
+       if (JobHistory < INT_MAX)
+-      job->history_time = attr->values[0].integer + JobHistory;
++      job->history_time = job->completed_time + JobHistory;
+       else
+       job->history_time = INT_MAX;
+ 
+@@ -2877,7 +2877,7 @@ cupsdUpdateJobs(void)
+       JobHistoryUpdate = job->history_time;
+ 
+       if (JobFiles < INT_MAX)
+-      job->file_time = attr->values[0].integer + JobFiles;
++      job->file_time = job->completed_time + JobFiles;
+       else
+       job->file_time = INT_MAX;
+ 
+@@ -4693,7 +4693,7 @@ set_time(cupsd_job_t *job,               /* I - Job to 
update */
+     job->completed_time = curtime;
+ 
+     if (JobHistory < INT_MAX && attr)
+-      job->history_time = attr->values[0].integer + JobHistory;
++      job->history_time = job->completed_time + JobHistory;
+     else
+       job->history_time = INT_MAX;
+ 
+@@ -4701,7 +4701,7 @@ set_time(cupsd_job_t *job,               /* I - Job to 
update */
+       JobHistoryUpdate = job->history_time;
+ 
+     if (JobFiles < INT_MAX && attr)
+-      job->file_time = curtime + JobFiles;
++      job->file_time = job->completed_time + JobFiles;
+     else
+       job->file_time = INT_MAX;
+ 
diff -Nru cups-2.2.10/debian/patches/manpage-translations.patch 
cups-2.2.10/debian/patches/manpage-translations.patch
--- cups-2.2.10/debian/patches/manpage-translations.patch       2019-03-27 
17:13:07.000000000 +0100
+++ cups-2.2.10/debian/patches/manpage-translations.patch       2019-04-23 
08:33:01.000000000 +0200
@@ -1,4 +1,4 @@
-From 2fb6d0075ed13f2fd03a8600a6ecb0892818116b Mon Sep 17 00:00:00 2001
+From 9615ef5f2b8374bfe2816f8ff4314234362ce841 Mon Sep 17 00:00:00 2001
 From: Didier Raboud <o...@debian.org>
 Date: Tue, 9 Aug 2016 18:11:50 +0200
 Subject: po4a infrastructure and translations for manpages.
diff -Nru cups-2.2.10/debian/patches/series cups-2.2.10/debian/patches/series
--- cups-2.2.10/debian/patches/series   2019-03-27 17:13:07.000000000 +0100
+++ cups-2.2.10/debian/patches/series   2019-04-23 08:33:01.000000000 +0200
@@ -42,4 +42,5 @@
 0042-Fix-compile-error-on-Linux-Issue-5483.patch
 0043-Stop-parsing-the-Emulators-keywords-in-PPD-files-Iss.patch
 0044-Fix-potential-unaligned-accesses-in-the-string-pool-.patch
+0045-Fix-an-issue-with-PreserveJobHistory-and-time-values.patch
 manpage-translations.patch
>From 917e6f4ff70eed933c80d21eed4c6bfeb2cb68b7 Mon Sep 17 00:00:00 2001
From: Michael R Sweet <michael.r.sw...@gmail.com>
Date: Mon, 11 Mar 2019 13:54:46 -0400
Subject: Fix an issue with `PreserveJobHistory` and time values (Issue #5538)

Closes: #921741
---
 scheduler/job.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/scheduler/job.c b/scheduler/job.c
index cc9283fb8..d4793cbb1 100644
--- a/scheduler/job.c
+++ b/scheduler/job.c
@@ -437,10 +437,20 @@ cupsdCleanJobs(void)
   curtime          = time(NULL);
   JobHistoryUpdate = 0;
 
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCleanJobs: curtime=%d", 
(int)curtime);
+
   for (job = (cupsd_job_t *)cupsArrayFirst(Jobs);
        job;
        job = (cupsd_job_t *)cupsArrayNext(Jobs))
   {
+    cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCleanJobs: Job %d, state=%d, 
printer=%p, history_time=%d, file_time=%d", job->id, (int)job->state_value, 
(void *)job->printer, (int)job->history_time, (int)job->file_time);
+
+    if ((job->history_time && job->history_time) < JobHistoryUpdate || 
!JobHistoryUpdate)
+      JobHistoryUpdate = job->history_time;
+
+    if ((job->file_time && job->file_time < JobHistoryUpdate) || 
!JobHistoryUpdate)
+      JobHistoryUpdate = job->file_time;
+
     if (job->state_value >= IPP_JOB_CANCELED && !job->printer)
     {
      /*
@@ -456,21 +466,9 @@ cupsdCleanJobs(void)
       else if (job->file_time && job->file_time <= curtime)
       {
         cupsdLogJob(job, CUPSD_LOG_DEBUG, "Removing document files.");
-        cupsdLogJob(job, CUPSD_LOG_DEBUG2, "curtime=%ld, job->file_time=%ld", 
(long)curtime, (long)job->file_time);
         remove_job_files(job);
 
         cupsdMarkDirty(CUPSD_DIRTY_JOBS);
-
-        if (job->history_time < JobHistoryUpdate || !JobHistoryUpdate)
-         JobHistoryUpdate = job->history_time;
-      }
-      else
-      {
-        if (job->history_time < JobHistoryUpdate || !JobHistoryUpdate)
-         JobHistoryUpdate = job->history_time;
-
-       if (job->file_time < JobHistoryUpdate || !JobHistoryUpdate)
-         JobHistoryUpdate = job->file_time;
       }
     }
   }
@@ -1729,7 +1727,7 @@ cupsdLoadJob(cupsd_job_t *job)            /* I - Job */
     job->completed_time = attr->values[0].integer;
 
     if (JobHistory < INT_MAX)
-      job->history_time = attr->values[0].integer + JobHistory;
+      job->history_time = job->completed_time + JobHistory;
     else
       job->history_time = INT_MAX;
 
@@ -1740,7 +1738,7 @@ cupsdLoadJob(cupsd_job_t *job)            /* I - Job */
       JobHistoryUpdate = job->history_time;
 
     if (JobFiles < INT_MAX)
-      job->file_time = attr->values[0].integer + JobFiles;
+      job->file_time = job->completed_time + JobFiles;
     else
       job->file_time = INT_MAX;
 
@@ -2862,8 +2860,10 @@ cupsdUpdateJobs(void)
       * Update history/file expiration times...
       */
 
+      job->completed_time = attr->values[0].integer;
+
       if (JobHistory < INT_MAX)
-       job->history_time = attr->values[0].integer + JobHistory;
+       job->history_time = job->completed_time + JobHistory;
       else
        job->history_time = INT_MAX;
 
@@ -2877,7 +2877,7 @@ cupsdUpdateJobs(void)
        JobHistoryUpdate = job->history_time;
 
       if (JobFiles < INT_MAX)
-       job->file_time = attr->values[0].integer + JobFiles;
+       job->file_time = job->completed_time + JobFiles;
       else
        job->file_time = INT_MAX;
 
@@ -4693,7 +4693,7 @@ set_time(cupsd_job_t *job,                /* I - Job to 
update */
     job->completed_time = curtime;
 
     if (JobHistory < INT_MAX && attr)
-      job->history_time = attr->values[0].integer + JobHistory;
+      job->history_time = job->completed_time + JobHistory;
     else
       job->history_time = INT_MAX;
 
@@ -4701,7 +4701,7 @@ set_time(cupsd_job_t *job,                /* I - Job to 
update */
       JobHistoryUpdate = job->history_time;
 
     if (JobFiles < INT_MAX && attr)
-      job->file_time = curtime + JobFiles;
+      job->file_time = job->completed_time + JobFiles;
     else
       job->file_time = INT_MAX;
 

Reply via email to