[cups.bugs] [LOW] STR #3466: JobRetryLimit is either off by one or ill documented

Bart Dopheide bart.dopheide at ordina.nl
Tue Jan 5 14:05:22 PST 2010


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

A new job in scheduler/job.c is created with calloc:
  ...
  if ((job = calloc(sizeof(cupsd_job_t), 1)) == NULL)
  ...
This means that job->tries equals 0.

The documentation about JobRetryLimit (man/cupsd.conf.man.in):
       JobRetryLimit count
            Specifies the number of retries that are done for jobs.
So, if I set JobRetryLimit to 1, I expect that a job is tried /twice/:
1) 1 normal try
2) 1 retry

But the actual code in scheduler/job.c:
              ...
              job->tries ++;

              if (job->tries >= JobRetryLimit)
              {
               /*
                * Too many tries...
                */
              ...
At the first (normal) try, job->tries changes from 0 to 1. This triggers
the JobRetryLimit, while it should trigger at attempt two. Hence, an
off-by-one error.

IMHO a bug, but arguably a document error.

Link: http://www.cups.org/str.php?L3466
Version: 1.4.2





More information about the cups-devel mailing list