cupsGetJobs() returns error "The printer or class was not found." #3107

michaelrsweet opened this Issue Feb 19, 2009 · 4 comments


None yet
1 participant

michaelrsweet commented Feb 19, 2009

Version: 1.3-current User: murdie

I've a little program running as root whose job it is to call cupsGetJobs(&jobs, NULL, 0, CUPS_WHICHJOBS_ALL) once an hour and call cupsCancelJob() for any job which has been held for 24 hours or more. (This to keep our job queue clean.) It works fine with 1.3.*, but for a 1.4b2 test installation I'm getting the return value -1 and the error "The printer or class was not found."

The source code in question is:

/* Cancel any jobs which have been held for more than the configured
 * maximum hold time. E-mail the user to tell them what has happened.
age = printerconfig[maxJobHoldDuration].i;
firsttime = time(NULL) - age;
num_jobs = cupsGetJobs(&jobs, NULL, 0, CUPS_WHICHJOBS_COMPLETED);
startlogline(level(printerconfig[logLevel].s), debug,"num_jobs %d\n", num_jobs);
if (num_jobs >= 0) {
    for (i = 0, job = jobs; i < num_jobs; i++, job++)
        if (job->state == IPP_JOB_HELD && job->creation_time < firsttime) {
            startlogline(level(printerconfig[logLevel].s), info,
                "Canceling %s-%d (%s) queued by %s at %d ...\n",
                job->dest, job->id, job->title, job->user,
                toisotime(job->creation_time, isotimebuf));
            cupsCancelJob(job->dest, job->id);
            informuser(level(printerconfig[logLevel].s), printerconfig[sendmailPath].s,
                job->user, job->dest, job->id, job->title, 
    cupsFreeJobs(num_jobs, jobs);
} else
    startlogline(level(printerconfig[logLevel].s), info,
            "cupsGetJobs() returns num_jobs %d error \"%s\"\n", num_jobs,

John A. Murdie


michaelrsweet commented Feb 25, 2009 User: mike

Fixed in Subversion repository.

Just passing in a bad printer-uri...


michaelrsweet commented Mar 5, 2009 User: mike

Apparently this bug also affects 1.3; re-opening pending a backport of the fix.


michaelrsweet commented Mar 5, 2009 User: mike

Backported fixes to CUPS 1.3 in r8407...


michaelrsweet commented Mar 5, 2009


Index: cups/util.c

--- cups/util.c (revision 8391)
+++ cups/util.c (working copy)
@@ -616,7 +616,7 @@

  • strcpy(uri, "ipp://localhost/jobs");
  • strcpy(uri, "ipp://localhost/");

if (!http)
if ((http = _cupsConnect()) == NULL)

@michaelrsweet michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment