Bug 614908 - lpstat -p' always reports job id as '-0'.
Summary: lpstat -p' always reports job id as '-0'.
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: cups   
(Show other bugs)
Version: 6.0
Hardware: All Linux
Target Milestone: rc
: ---
Assignee: Tim Waugh
QA Contact:
Keywords: Patch
Depends On:
Blocks: 627601
TreeView+ depends on / blocked
Reported: 2010-07-15 14:28 UTC by Olivier Fourdan
Modified: 2018-11-14 19:20 UTC (History)
5 users (show)

Fixed In Version: cups-1.4.2-37.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-05-19 14:09:14 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
request also job-state attribute (412 bytes, patch)
2010-07-22 18:43 UTC, Jiri Popelka
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0715 normal SHIPPED_LIVE cups bug fix update 2011-05-18 18:09:48 UTC
CUPS Bugs and Features 3627 None None None Never

Description Olivier Fourdan 2010-07-15 14:28:17 UTC
Description of problem:

lpstat -p always reports the current job as job id zero.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. lp -d someprinter somefile.txt
2. lpstat -p 
Actual results:

   $ lp -d someprinter somefile.txt
   request id is someprinter-29 (1 file(s))
   $ ./lpstat -p
   printer someprinter now printing someprinter-0.  enabled since Tue 13 Jul 2010 01:53:25 PM CEST

(Notice the job is "someprinter-29" whereas lpstat reports "someprinter-0" as being printed)

Expected results:

   $ lp -d someprinter somefile.txt
   request id is someprinter-30 (1 file(s))
   $ ./lpstat -p
   printer someprinter now printing someprinter-30.  enabled since Tue 13 Jul 2010 01:53:25 PM CEST

Additional info:

This is caused by SVN revision 7620 upstream to fix STR #2845

Reverting that patch does list the correct job id (but obviously reintroduces the bug for 2845 so this is not the solution).

In lpstat.c:

 if ((jobs = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/")) != NULL)
   * Get the current active job on this queue...

   ipp_jstate_t jobstate = IPP_JOB_PENDING;
   jobid = 0;

   for (jobattr = jobs->attrs; jobattr; jobattr = jobattr->next)
     if (!jobattr->name)
       if (jobstate == IPP_JOB_PROCESSING)

     if (!strcmp(jobattr->name, "job-id") &&
         jobattr->value_tag == IPP_TAG_INTEGER)
       jobid = jobattr->values[0].integer;
     else if (!strcmp(jobattr->name, "job-state") &&
              jobattr->value_tag == IPP_TAG_ENUM)
       jobstate = jobattr->values[0].integer;

   if (jobstate != IPP_JOB_PROCESSING)
     jobid = 0;


The problem is that the jobstate is never IPP_JOB_PROCESSING apparently.

I tried running lpstat in a loop while printing a file and did not get a single correct output.

Yet I guess it's correct for lpstat to assume that if the printer is in state processing, then at least one job in the list in also in state processing, so I wonder if this is a bug in lpstat or in the scheduler.

I am escalating this to bugzilla although I do not have a patch yet, the reason for this being that our partner has reported this issue as severity high.

Comment 1 RHEL Product and Program Management 2010-07-15 15:38:57 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release. It has
been denied for the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 2 Jiri Popelka 2010-07-22 18:43:07 UTC
Created attachment 433771 [details]
request also job-state attribute

(In reply to comment #0)
> The problem is that the jobstate is never IPP_JOB_PROCESSING apparently.

That's probably because we are not requesting job-state attribute.
Can you try this patch ?

Comment 9 errata-xmlrpc 2011-05-19 14:09:14 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.