RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 614908 - lpstat -p' always reports job id as '-0'.
Summary: lpstat -p' always reports job id as '-0'.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: cups
Version: 6.0
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
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:
Clone Of:
Environment:
Last Closed: 2011-05-19 14:09:14 UTC
Target Upstream Version:
Embargoed:


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


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

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):

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 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.

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.