From b485551a771de42fed4b5dfe7c749e899a691d07 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 18 Sep 2018 11:42:08 -0400 Subject: [PATCH] Log actual location of error_log (Issue #5398) --- CHANGES.md | 3 ++- scheduler/job.c | 56 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9df73f0a85..e14a20858e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -CHANGES - 2.2.9 - 2018-08-28 +CHANGES - 2.2.9 - 2018-09-18 ============================ @@ -23,6 +23,7 @@ Changes in CUPS v2.2.9 - The PPD compiler incorrectly terminated JCL options (Issue #5379) - The cupstestppd utility did not generate errors for missing/mismatched CloseUI/JCLCloseUI keywords (Issue #5381) +- The scheduler now reports the actual location of the log file (Issue #5398) - The scheduler was being backgrounded on macOS, causing applications to spin (rdar://40436080) - The scheduler did not validate that required initial request attributes were diff --git a/scheduler/job.c b/scheduler/job.c index ed8267d5d9..554e09215d 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -3330,8 +3330,14 @@ finalize_job(cupsd_job_t *job, /* I - Job */ job_state == IPP_JOB_COMPLETED) { job_state = IPP_JOB_ABORTED; - message = "Job aborted due to backend errors; please consult " - "the error_log file for details."; + + if (ErrorLog) + { + snprintf(buffer, sizeof(buffer), "Job aborted due to backend errors; please consult the %s file for details.", ErrorLog); + message = buffer; + } + else + message = "Job aborted due to backend errors."; ippSetString(job->attrs, &job->reasons, 0, "aborted-by-system"); } @@ -3339,8 +3345,14 @@ finalize_job(cupsd_job_t *job, /* I - Job */ { job_state = IPP_JOB_PENDING; printer_state = IPP_PRINTER_STOPPED; - message = "Printer stopped due to backend errors; please " - "consult the error_log file for details."; + + if (ErrorLog) + { + snprintf(buffer, sizeof(buffer), "Printer stopped due to backend errors; please consult the %s file for details.", ErrorLog); + message = buffer; + } + else + message = "Printer stopped due to backend errors."; ippSetString(job->attrs, &job->reasons, 0, "none"); } @@ -3378,15 +3390,20 @@ finalize_job(cupsd_job_t *job, /* I - Job */ ippSetString(job->attrs, &job->reasons, 0, "job-hold-until-specified"); - message = "Job held indefinitely due to backend errors; please " - "consult the error_log file for details."; + + if (ErrorLog) + { + snprintf(buffer, sizeof(buffer), "Job held indefinitely due to backend errors; please consult the %s file for details.", ErrorLog); + message = buffer; + } + else + message = "Job held indefinitely due to backend errors."; } else if (!strcmp(reason, "account-info-needed")) { cupsdSetJobHoldUntil(job, "indefinite", 0); - message = "Job held indefinitely - account information is " - "required."; + message = "Job held indefinitely - account information is required."; } else if (!strcmp(reason, "account-closed")) { @@ -3398,8 +3415,7 @@ finalize_job(cupsd_job_t *job, /* I - Job */ { cupsdSetJobHoldUntil(job, "indefinite", 0); - message = "Job held indefinitely - account limit has been " - "reached."; + message = "Job held indefinitely - account limit has been reached."; } else { @@ -3418,8 +3434,14 @@ finalize_job(cupsd_job_t *job, /* I - Job */ */ printer_state = IPP_PRINTER_STOPPED; - message = "Printer stopped due to backend errors; please " - "consult the error_log file for details."; + + if (ErrorLog) + { + snprintf(buffer, sizeof(buffer), "Printer stopped due to backend errors; please consult the %s file for details.", ErrorLog); + message = buffer; + } + else + message = "Printer stopped due to backend errors."; if (job_state == IPP_JOB_COMPLETED) { @@ -3516,8 +3538,14 @@ finalize_job(cupsd_job_t *job, /* I - Job */ if (job_state == IPP_JOB_COMPLETED) { job_state = IPP_JOB_STOPPED; - message = "Job stopped due to filter errors; please consult the " - "error_log file for details."; + + if (ErrorLog) + { + snprintf(buffer, sizeof(buffer), "Job stopped due to filter errors; please consult the %s file for details.", ErrorLog); + message = buffer; + } + else + message = "Job stopped due to filter errors."; if (WIFSIGNALED(job->status)) ippSetString(job->attrs, &job->reasons, 0, "cups-filter-crashed"); -- 2.47.3