CUPS page accounting not working

Bug #126139 reported by DurvalMenezes
4
Affects Status Importance Assigned to Milestone
foo2zjs
Invalid
Undecided
Unassigned
foomatic-db
Fix Released
Undecided
Unassigned
foomatic-db-engine
Fix Released
Undecided
Unassigned
foomatic-filters
Fix Released
Undecided
Unassigned
foo2zjs (Ubuntu)
Invalid
Undecided
Unassigned
foomatic-db (Ubuntu)
Fix Released
Undecided
Unassigned
foomatic-db-engine (Ubuntu)
Fix Released
Undecided
Unassigned
foomatic-filters (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Version information:
      Ubuntu 7.04 Feisty with all updates applied
      CUPS 1.2.8 (Ubuntu package cupsys 1.2.8-0ubuntu8)
      Printer: HP Laserjet 1018 connected directly to an USB 2.0 port

Problem description:
     The "jobs" pages on CUPS admin always show "Unknown" for the number of pages printed;
     moreover, I checked /var/log/cups/page_log and it was empty.

Revision history for this message
DurvalMenezes (durval) wrote :

Investigation and solution:

    After some investigation, I found that CUPS depends on 'PAGE: n c' lines being
    output to stderr by pstops or one of the filters that are called for each page
    printed. Also, I found that when there's a PPD file configured for the printer,
    and that PPD defines at least 1 filter for it (as is the case with the.PPD files
    included with the foo2zjs package), the pstops program does NOT output the
    'PAGE: n c' lines, and so the CUPS page accounting can't register the number of
    pages being printed. I checked the source for other filters (e.g, rastertohp)
    and found that they indeed do output the required 'PAGE: n c' lines.

    From the above, I concluded that the problem is caused by foo2zjs not outputting
    the 'PAGE: n c' lines to stderr, so I made a patch to the current Ubuntu package
    sources (see attached patch).

    I've tested it and now page accounting works perfectly, with no ill
    side-effects (at least none that I can detect).

    I've also posted the above fix upstream (updated to the last upstream version),
    both to foo2zjs community forum at http://foo2zjs.rkkda.com/forum/read.php?8,488
   and directly to its author.

description: updated
description: updated
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Your solution will fix page accounting only for the foo2zjs drivers while many other drivers will stay without.

foomatic-rip, a filter used for integrating arbitrary printer drivers with CUPS (and other printing systems) has support for page accounting, but Debian maintainers turned it off by default due to problems with some drivers.

To activate it, enter

sudo dpkg-reconfigure foomatic-filters

and answer the third question with "Yes".

Try to print now with an unpatched foo2zjs driver. You should get the page accounting. If you do not get it, or if extra blank pages come out, please tell here.

Changed in foo2zjs:
status: New → Incomplete
status: New → Incomplete
Changed in foomatic-filters:
status: New → Incomplete
Changed in foomatic-filters:
status: New → Incomplete
Changed in foomatic-filters:
status: Incomplete → Fix Released
Changed in foomatic-db-engine:
status: New → Fix Released
Changed in foomatic-db:
status: New → Fix Released
Changed in foo2zjs:
status: Incomplete → Invalid
status: Incomplete → Invalid
Changed in foomatic-filters:
status: Incomplete → In Progress
Changed in foomatic-db-engine:
status: New → In Progress
Changed in foomatic-db:
status: New → In Progress
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

I have solved this problem now upstream in Foomatic. Foomatic has a facility for page accounting for all drivers, but this works by adding PostScript code into the PostScript data stream. This PostScript code can only pass the page counters to CUPS if it is executed by GhostScript and not for example in a printer. Also some of the drivers can be incompatible with the inserted accounting code. Therefore Foomatic's page accounting is turned off by default in the Debian and Ubuntu packages.

I have now added a feature to Foomatic that accounting can be suppressed on a per-driver basis. So in general accounting can be turned on again and if a driver is not compatible accounting will be turned off for it in its Foomatic driver XML file. In upstream Foomatic I have turned off accounting for the "Postscript" driver for now as it does not use Ghostscript.

With the next Ubuntu releases of Foomatic this feature will get available and I will turn on page accounting by default then.

Changed in foo2zjs:
status: Invalid → Incomplete
status: Invalid → Incomplete
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

DurvalMenezes, please still check whether Foomatic's accounting will work with foo2zjs. As foo2zjs uses a wrapper around Ghostscript it is possible that the page counting output does not reach CUPS. If Foomatic's accounting does not work for you, we must apply your patch and suppress Foomatic's accounting in the driver XML file of foo2zjs (also part of the foo2zjs package).

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Changed in foomatic-db:
status: In Progress → Fix Committed
Changed in foomatic-db-engine:
status: In Progress → Fix Committed
Changed in foomatic-filters:
status: In Progress → Fix Committed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

DurvalMenezes, I did the needed modifications on Foomatic now so that accounting is activated by default. But as it is still possible that some drivers do not work correctly with accounting or that the accounting info does not get to CUPS, please test with foo2zjs. This way we will find out whether foo2zjs still needs to be patched or no.

Changed in foomatic-db:
status: Fix Committed → Fix Released
Changed in foomatic-db-engine:
status: Fix Committed → Fix Released
Changed in foomatic-filters:
status: Fix Committed → Fix Released
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Download full text (3.4 KiB)

DurvalMeneze, please post always into the bug report, so that other users see the process of the bug fix. I cite your mail below.

As reactivating the Foomatic accounting facility solves the problem, I will mark the foo2zjs targets invalid. The changes on Foomatic fixed this bug.

-------------------------------------

Hello Till,

On Wed, Jul 18, 2007 at 09:36:40AM -0300, Durval Menezes wrote:
> > On Wed, Jul 18, 2007 at 10:25:29AM -0000, Till Kamppeter wrote:
>> > > Your solution will fix page accounting only for the foo2zjs drivers
>> > > while many other drivers will stay without.
> >
> > I was aware that the solution only applied to foo2zjs, but I did not
> > know that the problem was so widespread among other drivers.
> >
>> > > foomatic-rip, a filter used for integrating arbitrary printer drivers
>> > > with CUPS (and other printing systems) has support for page accounting,
>> > > but Debian maintainers turned it off by default due to problems with
>> > > some drivers.
>> > >
>> > > To activate it, enter
>> > >
>> > > sudo dpkg-reconfigure foomatic-filters
>> > >
>> > > and answer the third question with "Yes".
>> > >
>> > > Try to print now with an unpatched foo2zjs driver. You should get the
>> > > page accounting. If you do not get it, or if extra blank pages come out,
>> > > please tell here.
> >
> > Thanks for the tip. I will try it next time I'm at this machine
> > (Saturday morning) and will let you know.

Just tried it (sorry for taking that long: busy weekend of a busy week),
and it DID work, and also it DID NOT print any extra blank pages. To sum
it up: turning accounting on in foomatic-rip indeed solved the problem
when using the old (unfixed) foo2zjs, without any ill-effects that I
can detect, surely no extra blank pages.

Just a small correction: on my system (Ubuntu 7.04 "Feisty") the
dpkg-reconfigure dialog was as follows:

 - Printer spooler backend for foomatic
  -> options: cups, lpd, lprng, pdq, ppr, direct;

 - Enable logging debug output into a logfile (INSECURE)
  -> Options: Yes, No;

 - Page with explanation about the ghostscript interpreter
   selection;
  -> "Option": Ok;

 - Ghostscript interpreter to be used by Foomatic:
  -> Options: gs, gs-gnu, gs-esp, gs-afpl, Custom;

 - Enable PostScript accounting for CUPS?
  -> Options: Yes, No;

So, the question that I had to respond with Yes was the fourth
(or the fifth, if you count the "Ok" on the ghostscript interpreter
explanation page), and not the third.

Best Regards,
-- Durval Menezes (durval AT tmp DOT com DOT br, http://www.tmp.com.br/)
> > Best Regards,
> > --
> > Durval Menezes (durval AT tmp DOT com DOT br, http://www.tmp.com.br/)
> >
>> > >
>> > > ** Changed in: foo2zjs (Ubuntu)
>> > > Status: New => Incomplete
>> > >
>> > > ** Changed in: foo2zjs (upstream)
>> > > Status: New => Incomplete
>> > >
>> > > ** Also affects: foomatic-filters (Ubuntu)
>> > > Importance: Undecided
>> > > Status: New
>> > >
>> > > ** Changed in: foomatic-filters (Ubuntu)
>> > > Status: New => Incomplete
>> > >
>> > > ** Also affects: foomatic-filters (upstream)
>> > > Importance: Undecided
>> > > Status: New
>> > >
>...

Read more...

Changed in foo2zjs:
status: Incomplete → Invalid
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.