commands passed to cups fail. File missing

Bug #1500636 reported by Paul Newall
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
system-config-printer (Ubuntu)
Fix Released
High
Unassigned

Bug Description

xubuntu 15.04 64 bit
system-config-printer 1.5.6

when I click the button "Print self test page", I expect the printer to produce a self test page
instead I get error "client-error-bad-request" and no self test page.
the cups error log has the entry
Print-Job client-error-bad-request: No file in print request.

Note that I can get the printer to generate the self test page by printing a command file from terminal.

Added 3rdOct2015
The problem seems to be due to default buffering of the temporary command file. I can fix the problem by changing the buffering to buffer 1 line.

in file printerproperties.py
I changed the line 1232
         with tempfile.NamedTemporaryFile(mode='wt') as tmpfile:
to
        with tempfile.NamedTemporaryFile(mode='wt',buffering=1) as tmpfile:
and now the command file sending works for me.

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

Paul, which printer are you using? Does it actually support the functionality you are requesting? The "Print Self Test Page" is intended for printers which have a built in self test page (usually to discover clogged nozzles) and the driver is supposed to send a special code sequence to the printer to make the printer print this test page (not send a test page from the computer to the printer). "Clean Heads" is supposed to tell the printer to run its internal cleaning cycle.

Unfortunately, the buttons sometimes appear in the Properties dialog of system-config-printer if the printer does not have the mentioned functionality, for example with the virtual "PDF" printer which gets created when installing the cups-pdf package (there are really no print heads to clean).

Or are you developing printer maintenance support for your Kodak driver?

Changed in system-config-printer (Ubuntu):
status: New → Incomplete
Revision history for this message
Paul Newall (p-newalls) wrote :

Till, The printer is a kodak aio hero 9.1
and the driver is my c2espC driver, with command filter command2esp.
This all used to work, for both print self test and clean heads.
But recently I noticed that it no longer worked.

However, if I make a text command file called "selftest" containing
     #CUPS-COMMAND
     PrintSelfTestPage

and then send that page to the printer via cups using
lpr selftest
The printer does generate its selftest page.
So it seems like cups and my command filter still work.
That makes me think this could be a problem with system-config-printer.

Do these command buttons in system-config-printer currently work for other printers that have command filters?

Revision history for this message
Paul Newall (p-newalls) wrote :

More investigation:
Using ubuntu live DVDs : commands in system-config-printer of ubuntu 13.10 work OK. In ubuntu 14.10 they do not work.

I uninstalled system-config-printer 1.5.6 from my xubuntu 15.04, then installed version 1.3.8 The commands work OK.
So some change between system-config printer 1.3.8 and 1.4.3 seems to have stopped the commands from working.

Revision history for this message
Paul Newall (p-newalls) wrote : Re: [Bug 1500636] Re: commands passed to cups fail. File missing

Till,
system-config-printer version 1.3.8 works
version 1.5.6 does not work.

My impression is that the command file generated in printerproperties.py
using
         with tempfile.NamedTemporaryFile(mode='wt') as tmpfile:
             tmpfile.write ("#CUPS-COMMAND\n%s\n" % command)

has a size of zero bytes when the job is submitted to cups
maybe due to buffering?

in the older working version 1.3.8 the command file is generated using
         (tmpfd, tmpfname) = tempfile.mkstemp ()
         os.write (tmpfd, "#CUPS-COMMAND\n%s\n" % command)
         os.close (tmpfd)

Paul

On 29/09/15 01:27, Till Kamppeter wrote:
> Paul, which printer are you using? Does it actually support the
> functionality you are requesting? The "Print Self Test Page" is intended
> for printers which have a built in self test page (usually to discover
> clogged nozzles) and the driver is supposed to send a special code
> sequence to the printer to make the printer print this test page (not
> send a test page from the computer to the printer). "Clean Heads" is
> supposed to tell the printer to run its internal cleaning cycle.
>
> Unfortunately, the buttons sometimes appear in the Properties dialog of
> system-config-printer if the printer does not have the mentioned
> functionality, for example with the virtual "PDF" printer which gets
> created when installing the cups-pdf package (there are really no print
> heads to clean).
>
> Or are you developing printer maintenance support for your Kodak driver?
>
> ** Changed in: system-config-printer (Ubuntu)
> Status: New => Incomplete
>

Revision history for this message
Paul Newall (p-newalls) wrote :

Yes it seems to be a buffering problem
in file printerproperties.py
I changed the line
         with tempfile.NamedTemporaryFile(mode='wt') as tmpfile:
to
        with tempfile.NamedTemporaryFile(mode='wt',buffering=1) as tmpfile:
and now the command file sending works for me.

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

Paul, thank you very much for finding the fix. I will apply it soon so that it will be available in Wily.

Changed in system-config-printer (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Uploaded system-config-printer 1.5.7+20150819-0ubuntu3 with the fix.

Paul, thank you very much for the bug report and the patch.

Changed in system-config-printer (Ubuntu):
status: Triaged → Fix Committed
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package system-config-printer - 1.5.7+20150819-0ubuntu3

---------------
system-config-printer (1.5.7+20150819-0ubuntu3) wily; urgency=medium

  * debian/patches/37_command-file-buffering.patch: Fixed buffering
    problem which prevented command jobs (head cleaning, nozzle check
    page, ...) from being sent correctly to CUPS (LP: #1500636).

 -- Till Kamppeter <email address hidden> Sat, 3 Oct 2015 09:17:25 -0300

Changed in system-config-printer (Ubuntu):
status: Fix Committed → Fix Released
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.