CUPS page logging (page_log) broken with backend hp
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
HPLIP |
New
|
Undecided
|
Unassigned |
Bug Description
I've CUPS 1.3.11 and HPLIP 3.9.10 installed and running.
One motivation to switch from LPRnG to CUPS was it's built in accounting, especially page logging. Now I found out that my page_log file remains empty, although all print queues are regularily installed using current ppd files provided by HPLIP.
After some investigation I learned that page logging is triggered by PAGE: <num> <num> messages written by filter chain to stderr and then processed by cupsd. Furthermore last filter in chain is hpcups and hpcups does not write such DEBUG messages. Is that something that can be configured during compile time? Or is this issue already on HPLIP's road map?
What I found out so far is this:
- We've to look at whole process chains built out-of multiple filters and one backend process.
- hplip uses hp as backend
- hplip writes PAGE: 1 1 if and only if file descriptor fd is not zero (hp.c):
if (fd != 0)
{
lseek(fd, 0, SEEK_SET);
}
- hplip sets fd to zero if argc equals 6 (hp.c)
if (argc == 6)
{
fd = 0; /* use stdin. */
copies = 1;
}
That means backend hp does not write PAGE: messages to cupsd if operating in normal cups environment.
- cups' job.c sets argv[6] to NULL after first filter process is started. That makes sense because argv[6] is a pointer to print job source file and only first filter needs to know about that. All other processes build a filter chain reading from stdin and writing to stdout. It's cupsd's task to connect processes and pipes the right way.
taken from job.c of cups 1.3.11, lines 3382ff
cupsdLogMess
argv[6] = NULL;
slot = !slot;
}
This looks the same in job.c taken from 1.4.2 ( * "$Id: job.c 8801 2009-08-29 06:05:14Z mike $" )
IMHO backend hp is not compatible with current cups implementation.
Suggestion: move fputs(...) in front of if (fd != 0) { ... }:
fputs("PAGE: 1 1\n", stderr);
if (fd != 0)
{
/* start reading from beginning of given file */
lseek(fd, 0, SEEK_SET);
}
With this change in file prnt/backend/hp.c compiled and installed I got my very first page_log entry today:
litfass mjacobs 521 [20/Nov/
BR / Martin
This is a patch against prnt/backend/hp.c as described in my bug report.