Bug 614908 - lpstat -p' always reports job id as '-0'.
lpstat -p' always reports job id as '-0'.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: cups (Show other bugs)
6.0
All Linux
high Severity high
: rc
: ---
Assigned To: Tim Waugh
: Patch
Depends On:
Blocks: 627601
  Show dependency treegraph
 
Reported: 2010-07-15 10:28 EDT by Olivier Fourdan
Modified: 2013-03-03 21:49 EST (History)
5 users (show)

See Also:
Fixed In Version: cups-1.4.2-37.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-05-19 10:09:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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 14:43 EDT, Jiri Popelka
no flags Details | Diff


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

  None (edit)
Description Olivier Fourdan 2010-07-15 10:28:17 EDT
Description of problem:

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

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

cups-1.4.2-16.el6

How reproducible:

always

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)
         break;
       else
         continue;
     }

     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;

   ippDelete(jobs);
 } 

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 11:38:57 EDT
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 14:43:07 EDT
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 10:09:14 EDT
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.

http://rhn.redhat.com/errata/RHBA-2011-0715.html

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