summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2014-10-22 13:27:10 +0200
committerDidier Raboud <odyx@debian.org>2014-10-22 13:30:32 +0200
commite5d9d01a5ebbd40d5456ed5f859995b9889d3717 (patch)
treedb14b54eaa4bc580feaed771e21196d22425df8d
parent2fa31cf241a93a8527ab29951e64ceae54f2d4f9 (diff)
downloadcups-e5d9d01a5ebbd40d5456ed5f859995b9889d3717.tar.gz
Add upstream patch to enforce correct newest-to-oldest order in the completed jobs returned by the scheduler
STR: #4396
-rw-r--r--debian/patches/no-conffile-timestamp.patch2
-rw-r--r--debian/patches/read-embedded-options-from-incoming-postscript-and-add-to-ipp-attrs.patch4
-rw-r--r--debian/patches/revert-upstream-change-to-FINAL_CONTENT_TYPE-to-fix-printing-to-remote-CUPS-servers.patch2
-rw-r--r--debian/patches/rootbackends-worldreadable.patch2
-rw-r--r--debian/patches/series1
-rw-r--r--debian/patches/str4396-make-scheduler-return-completed-jobs-in-correct-order.patch269
-rw-r--r--debian/patches/str4475-fix-the-spinner-imager-on-restart.patch12
7 files changed, 280 insertions, 12 deletions
diff --git a/debian/patches/no-conffile-timestamp.patch b/debian/patches/no-conffile-timestamp.patch
index add7d0b3..b846eb27 100644
--- a/debian/patches/no-conffile-timestamp.patch
+++ b/debian/patches/no-conffile-timestamp.patch
@@ -16,7 +16,7 @@ Bug-Debian: http://bugs.debian.org/549673
/*
--- a/scheduler/job.c
+++ b/scheduler/job.c
-@@ -2091,7 +2091,7 @@
+@@ -2118,7 +2118,7 @@
strftime(temp, sizeof(temp) - 1, "%Y-%m-%d %H:%M", curdate);
cupsFilePuts(fp, "# Job cache file for " CUPS_SVERSION "\n");
diff --git a/debian/patches/read-embedded-options-from-incoming-postscript-and-add-to-ipp-attrs.patch b/debian/patches/read-embedded-options-from-incoming-postscript-and-add-to-ipp-attrs.patch
index a58e274a..1456fea9 100644
--- a/debian/patches/read-embedded-options-from-incoming-postscript-and-add-to-ipp-attrs.patch
+++ b/debian/patches/read-embedded-options-from-incoming-postscript-and-add-to-ipp-attrs.patch
@@ -11,7 +11,7 @@ Bug: https://www.cups.org/str.php?L4344
--- a/scheduler/ipp.c
+++ b/scheduler/ipp.c
-@@ -8269,6 +8269,11 @@
+@@ -8276,6 +8276,11 @@
ipp_attribute_t *attr, /* Current attribute */
*attr2, /* Job attribute */
*prev2; /* Previous job attribute */
@@ -23,7 +23,7 @@ Bug: https://www.cups.org/str.php?L4344
/*
-@@ -8330,6 +8335,85 @@
+@@ -8337,6 +8342,85 @@
}
/*
diff --git a/debian/patches/revert-upstream-change-to-FINAL_CONTENT_TYPE-to-fix-printing-to-remote-CUPS-servers.patch b/debian/patches/revert-upstream-change-to-FINAL_CONTENT_TYPE-to-fix-printing-to-remote-CUPS-servers.patch
index beea1078..f2179cb9 100644
--- a/debian/patches/revert-upstream-change-to-FINAL_CONTENT_TYPE-to-fix-printing-to-remote-CUPS-servers.patch
+++ b/debian/patches/revert-upstream-change-to-FINAL_CONTENT_TYPE-to-fix-printing-to-remote-CUPS-servers.patch
@@ -3,7 +3,7 @@ Bug-RedHat: https://bugzilla.redhat.com/show_bug.cgi?id=1010580
Last-Updated: 2013-11-28
--- a/scheduler/job.c
+++ b/scheduler/job.c
-@@ -599,12 +599,7 @@
+@@ -600,12 +600,7 @@
if (!job->printer->remote)
{
diff --git a/debian/patches/rootbackends-worldreadable.patch b/debian/patches/rootbackends-worldreadable.patch
index a79e2749..8ea94cd7 100644
--- a/debian/patches/rootbackends-worldreadable.patch
+++ b/debian/patches/rootbackends-worldreadable.patch
@@ -27,7 +27,7 @@ Bug-Debian: http://bugs.debian.org/410171
cupsDirClose(dir);
--- a/scheduler/job.c
+++ b/scheduler/job.c
-@@ -1206,7 +1206,7 @@
+@@ -1207,7 +1207,7 @@
else if (stat(command, &backinfo))
backroot = 0;
else
diff --git a/debian/patches/series b/debian/patches/series
index 4cbb9fa9..7dae8df5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,5 @@
# patches accepted and committed upstream
+str4396-make-scheduler-return-completed-jobs-in-correct-order.patch
str4461-restore-access-to-logfiles.patch
str4475-fix-the-spinner-imager-on-restart.patch
diff --git a/debian/patches/str4396-make-scheduler-return-completed-jobs-in-correct-order.patch b/debian/patches/str4396-make-scheduler-return-completed-jobs-in-correct-order.patch
new file mode 100644
index 00000000..11168884
--- /dev/null
+++ b/debian/patches/str4396-make-scheduler-return-completed-jobs-in-correct-order.patch
@@ -0,0 +1,269 @@
+Description: The scheduler now returns completed jobs in the correct newest-to-oldest order
+Bug: https://www.cups.org/str.php?L4396
+Author: Michael Sweet <msweet@apple.com>
+Last-Update: 2014-10-22
+--- a/scheduler/ipp.c
++++ b/scheduler/ipp.c
+@@ -6131,6 +6131,7 @@
+ cupsd_job_t *job; /* Current job pointer */
+ cupsd_printer_t *printer; /* Printer */
+ cups_array_t *list; /* Which job list... */
++ int delete_list = 0; /* Delete the list afterwards? */
+ cups_array_t *ra, /* Requested attributes array */
+ *exclude; /* Private attributes array */
+ cupsd_policy_t *policy; /* Current policy */
+@@ -6230,13 +6231,15 @@
+ {
+ job_comparison = 1;
+ job_state = IPP_JOB_CANCELED;
+- list = Jobs;
++ list = cupsdGetCompletedJobs(printer);
++ delete_list = 1;
+ }
+ else if (!strcmp(attr->values[0].string.text, "aborted"))
+ {
+ job_comparison = 0;
+ job_state = IPP_JOB_ABORTED;
+- list = Jobs;
++ list = cupsdGetCompletedJobs(printer);
++ delete_list = 1;
+ }
+ else if (!strcmp(attr->values[0].string.text, "all"))
+ {
+@@ -6248,7 +6251,8 @@
+ {
+ job_comparison = 0;
+ job_state = IPP_JOB_CANCELED;
+- list = Jobs;
++ list = cupsdGetCompletedJobs(printer);
++ delete_list = 1;
+ }
+ else if (!strcmp(attr->values[0].string.text, "pending"))
+ {
+@@ -6450,6 +6454,9 @@
+
+ cupsArrayDelete(ra);
+
++ if (delete_list)
++ cupsArrayDelete(list);
++
+ con->response->request.status.status_code = IPP_OK;
+ }
+
+--- a/scheduler/job.c
++++ b/scheduler/job.c
+@@ -119,6 +119,7 @@
+ */
+
+ static int compare_active_jobs(void *first, void *second, void *data);
++static int compare_completed_jobs(void *first, void *second, void *data);
+ static int compare_jobs(void *first, void *second, void *data);
+ static void dump_job_history(cupsd_job_t *job);
+ static void finalize_job(cupsd_job_t *job, int set_job_state);
+@@ -1429,6 +1430,30 @@
+
+
+ /*
++ * 'cupsdGetCompletedJobs()'- Generate a completed jobs list.
++ */
++
++cups_array_t * /* O - Array of jobs */
++cupsdGetCompletedJobs(
++ cupsd_printer_t *p) /* I - Printer */
++{
++ cups_array_t *list; /* Array of jobs */
++ cupsd_job_t *job; /* Current job */
++
++
++ list = cupsArrayNew(compare_completed_jobs, NULL);
++
++ for (job = (cupsd_job_t *)cupsArrayFirst(Jobs);
++ job;
++ job = (cupsd_job_t *)cupsArrayNext(Jobs))
++ if ((!p || !_cups_strcasecmp(p->name, job->dest)) && job->state_value >= IPP_JOB_STOPPED && job->completed_time)
++ cupsArrayAdd(list, job);
++
++ return (list);
++}
++
++
++/*
+ * 'cupsdGetPrinterJobCount()' - Get the number of pending, processing,
+ * or held jobs in a printer or class.
+ */
+@@ -1627,6 +1652,8 @@
+ (attr = ippFindAttribute(job->attrs, "time-at-completed",
+ IPP_TAG_INTEGER)) != NULL)
+ {
++ job->completed_time = attr->values[0].integer;
++
+ if (JobHistory < INT_MAX)
+ job->history_time = attr->values[0].integer + JobHistory;
+ else
+@@ -2104,8 +2131,11 @@
+ {
+ cupsFilePrintf(fp, "<Job %d>\n", job->id);
+ cupsFilePrintf(fp, "State %d\n", job->state_value);
++ if (job->completed_time)
++ cupsFilePrintf(fp, "Completed %ld\n", (long)job->completed_time);
+ cupsFilePrintf(fp, "Priority %d\n", job->priority);
+- cupsFilePrintf(fp, "HoldUntil %d\n", (int)job->hold_until);
++ if (job->hold_until)
++ cupsFilePrintf(fp, "HoldUntil %ld\n", (long)job->hold_until);
+ cupsFilePrintf(fp, "Username %s\n", job->username);
+ cupsFilePrintf(fp, "Destination %s\n", job->dest);
+ cupsFilePrintf(fp, "DestType %d\n", job->dtype);
+@@ -2762,6 +2792,28 @@
+
+
+ /*
++ * 'compare_completed_jobs()' - Compare the job IDs and completion times of two jobs.
++ */
++
++static int /* O - Difference */
++compare_completed_jobs(void *first, /* I - First job */
++ void *second, /* I - Second job */
++ void *data) /* I - App data (not used) */
++{
++ int diff; /* Difference */
++
++
++ (void)data;
++
++ if ((diff = ((cupsd_job_t *)second)->completed_time -
++ ((cupsd_job_t *)first)->completed_time) != 0)
++ return (diff);
++ else
++ return (((cupsd_job_t *)first)->id - ((cupsd_job_t *)second)->id);
++}
++
++
++/*
+ * 'compare_jobs()' - Compare the job IDs of two jobs.
+ */
+
+@@ -4025,6 +4077,14 @@
+
+ if (job->state_value <= IPP_JOB_STOPPED && cupsdLoadJob(job))
+ cupsArrayAdd(ActiveJobs, job);
++ else if (job->state_value > IPP_JOB_STOPPED)
++ {
++ if (!job->completed_time)
++ {
++ cupsdLoadJob(job);
++ unload_job(job);
++ }
++ }
+
+ job = NULL;
+ }
+@@ -4042,9 +4102,13 @@
+ else if (job->state_value > IPP_JOB_COMPLETED)
+ job->state_value = IPP_JOB_COMPLETED;
+ }
++ else if (!_cups_strcasecmp(line, "Completed"))
++ {
++ job->completed_time = strtol(value, NULL, 10);
++ }
+ else if (!_cups_strcasecmp(line, "HoldUntil"))
+ {
+- job->hold_until = atoi(value);
++ job->hold_until = strtol(value, NULL, 10);
+ }
+ else if (!_cups_strcasecmp(line, "Priority"))
+ {
+@@ -4382,6 +4446,8 @@
+
+ if (!strcmp(name, "time-at-completed"))
+ {
++ job->completed_time = curtime;
++
+ if (JobHistory < INT_MAX && attr)
+ job->history_time = attr->values[0].integer + JobHistory;
+ else
+--- a/scheduler/job.h
++++ b/scheduler/job.h
+@@ -47,6 +47,7 @@
+ ipp_attribute_t *sheets; /* job-media-sheets-completed */
+ time_t access_time, /* Last access time */
+ cancel_time, /* When to cancel/send SIGTERM */
++ completed_time, /* When job was completed (0 if not) */
+ file_time, /* Job file retain time */
+ history_time, /* Job history retain time */
+ hold_until, /* Hold expiration date/time */
+@@ -145,6 +146,7 @@
+ cupsd_jobaction_t action);
+ extern cupsd_job_t *cupsdFindJob(int id);
+ extern void cupsdFreeAllJobs(void);
++extern cups_array_t *cupsdGetCompletedJobs(cupsd_printer_t *p);
+ extern int cupsdGetPrinterJobCount(const char *dest);
+ extern int cupsdGetUserJobCount(const char *username);
+ extern void cupsdLoadAllJobs(void);
+--- a/systemv/lpstat.c
++++ b/systemv/lpstat.c
+@@ -1316,7 +1316,8 @@
+ const char *dest, /* Pointer into job-printer-uri */
+ *username, /* Pointer to job-originating-user-name */
+ *title, /* Pointer to job-name */
+- *message; /* Pointer to job-printer-state-message */
++ *message, /* Pointer to job-printer-state-message */
++ *time_at; /* time-at-xxx attribute name to use */
+ int rank, /* Rank in queue */
+ jobid, /* job-id */
+ size; /* job-k-octets */
+@@ -1332,7 +1333,8 @@
+ "job-printer-state-message",
+ "job-printer-uri",
+ "job-state-reasons",
+- "time-at-creation"
++ "time-at-creation",
++ "time-at-completed"
+ };
+
+
+@@ -1398,6 +1400,13 @@
+ * Loop through the job list and display them...
+ */
+
++ if (!strcmp(which, "aborted") ||
++ !strcmp(which, "canceled") ||
++ !strcmp(which, "completed"))
++ time_at = "time-at-completed";
++ else
++ time_at = "time-at-creation";
++
+ rank = -1;
+
+ for (attr = response->attrs; attr != NULL; attr = attr->next)
+@@ -1433,8 +1442,7 @@
+ else if (!strcmp(attr->name, "job-k-octets") &&
+ attr->value_tag == IPP_TAG_INTEGER)
+ size = attr->values[0].integer;
+- else if (!strcmp(attr->name, "time-at-creation") &&
+- attr->value_tag == IPP_TAG_INTEGER)
++ else if (!strcmp(attr->name, time_at) && attr->value_tag == IPP_TAG_INTEGER)
+ jobtime = attr->values[0].integer;
+ else if (!strcmp(attr->name, "job-printer-state-message") &&
+ attr->value_tag == IPP_TAG_TEXT)
+--- a/test/5.5-lp.sh
++++ b/test/5.5-lp.sh
+@@ -79,6 +79,19 @@
+
+ ./waitjobs.sh
+
++echo "LPSTAT Completed Jobs Order Test"
++echo ""
++echo " lpstat -W completed -o"
++$VALGRIND ../systemv/lpstat -W completed -o | tee $BASE/lpstat-completed.txt
++if test "`uniq -d $BASE/lpstat-completed.txt`" != ""; then
++ echo " FAILED"
++ exit 1
++else
++ echo " PASSED"
++fi
++echo ""
++
++
+ #
+ # End of "$Id: 5.5-lp.sh 11396 2013-11-06 20:09:03Z msweet $".
+ #
diff --git a/debian/patches/str4475-fix-the-spinner-imager-on-restart.patch b/debian/patches/str4475-fix-the-spinner-imager-on-restart.patch
index e4d2e701..6a16eac3 100644
--- a/debian/patches/str4475-fix-the-spinner-imager-on-restart.patch
+++ b/debian/patches/str4475-fix-the-spinner-imager-on-restart.patch
@@ -3,10 +3,9 @@ Author: Michael Sweet <msweet@apple.com>
Origin: upstream
Bug: https://www.cups.org/str.php?L4475
Last-Update: 2014-10-22
-diff -up cups-1.7.5/cgi-bin/admin.c.str4475 cups-1.7.5/cgi-bin/admin.c
---- cups-1.7.5/cgi-bin/admin.c.str4475 2014-09-01 13:03:51.295152124 +0100
-+++ cups-1.7.5/cgi-bin/admin.c 2014-09-01 13:03:59.367197078 +0100
-@@ -1917,7 +1917,7 @@ do_config_server(http_t *http) /* I - H
+--- a/cgi-bin/admin.c
++++ b/cgi-bin/admin.c
+@@ -1917,7 +1917,7 @@
}
else
{
@@ -15,9 +14,8 @@ diff -up cups-1.7.5/cgi-bin/admin.c.str4475 cups-1.7.5/cgi-bin/admin.c
cgiStartHTML(cgiText(_("Edit Configuration File")));
cgiCopyTemplateLang("restart.tmpl");
-diff -up cups-1.7.5/templates/restart.tmpl.str4475 cups-1.7.5/templates/restart.tmpl
---- cups-1.7.5/templates/restart.tmpl.str4475 2008-10-08 23:50:16.000000000 +0100
-+++ cups-1.7.5/templates/restart.tmpl 2014-09-01 13:03:59.368197084 +0100
+--- a/templates/restart.tmpl
++++ b/templates/restart.tmpl
@@ -2,7 +2,7 @@
<H2 CLASS="title">Change Settings</H2>