GTK Print dialog sends broken custom page size attribute: "PageSize=Custom.Custom.<width>x<length>"

Bug #998156 reported by Jan Heitkötter
174
This bug affects 37 people
Affects Status Importance Assigned to Milestone
GTK+
Fix Released
Critical
Ubuntu
In Progress
High
Unassigned
Precise
Won't Fix
High
Unassigned
Quantal
Won't Fix
High
Unassigned
firefox (Ubuntu)
Invalid
Medium
Unassigned
Precise
Invalid
High
Unassigned
Quantal
Invalid
Medium
Unassigned
gimp (Ubuntu)
Confirmed
Medium
anil
Precise
Invalid
High
Unassigned
Quantal
Invalid
Medium
Unassigned
gtk+2.0 (Debian)
Fix Released
Unknown
gtk+3.0 (Ubuntu)
Fix Released
Medium
Unassigned
Precise
Won't Fix
High
Unassigned
Quantal
Fix Released
Medium
Unassigned
inkscape (Ubuntu)
Invalid
Medium
Unassigned
Precise
Invalid
High
Unassigned
Quantal
Invalid
Medium
Unassigned

Bug Description

[Impact]

[Fix]

[Test Case]

[Regression Potential]

[Original Report]
When trying to print a photo, the printer stops with status "rendering completed". I have to remove all printing jobs and restart CUPS to be able to print again. This error does not occur when printing other documents, i.e. simple text.

I use a HP PhotoSmart b109a connected to a Fritz!Box 7390 wireless router ("socket://fritz.box:9100").

This bug is also present in Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=664031

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

This bug first appeared in Ubuntu 12.04 LTS 32 bit. It didn't show up in earlier versions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cups (Ubuntu):
status: New → Confirmed
Revision history for this message
Marc Quinton (m.quinton) wrote :

I have an Epson Stylus SX515W and this bug affects me too.

Revision history for this message
Marc Quinton (mquinton) wrote :

- restarting CUPS did not allow to print,
- resizing print job from 12Mo to =~ 4Mo did not worked,
- printing text jobs is OK for my config.

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

Now printing a web page does not work: "rendering completed" and removing the job/restarting CUPS does not help. As this is an important document, I have to do an "emergency PDF print".

Printing must not be broken in an LTS release!

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

Printing a test page works. Printing a web page stalls.

Revision history for this message
Marc Quinton (m.quinton) wrote :

good news, I changed printer settings, using "dnssd" connexion and now it works. Here is a screenshot : http://minus.com/mpPPYTdMt/

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

Can you add my PPA to your system's software sources, following the instructions under "Adding this PPA to your system" on

https://launchpad.net/~till-kamppeter/+archive/ppa

and then update your system. You should get the CUPS packages of version 1.5.3-0ubuntu2~ppa1 then.

Now test again and tell us whether this solves your problem (so that you can use your printer with "socket://...").

Revision history for this message
Marc Quinton (m.quinton) wrote :

thank you Till.

I have not been able to reproduce this bug before upgrading CUPS with your PPA. But, I have made some tests after upgrade. It seems to be OK for me, for both printer sockets.

many thanks.

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

Marc, does this mean that everything is working now for you, with the original CUPS package of CUPS 12.04, without any update, and even with the printer set up with the "socket://..." URI?

Revision history for this message
Marc Quinton (mquinton) wrote : Re: [Bug 998156] Re: Printing stalls with "rendering completed"

On Sun, May 27, 2012 at 7:41 PM, Till Kamppeter
<email address hidden> wrote:
> Marc, does this mean that everything is working now for you, with the
> original CUPS package of CUPS 12.04, without any update, and even with
> the printer set up with the "socket://..." URI?

yes I think. I have not been able to reproduce the bug. All is OK now,
with original CUPS and also with your PPA. I have also tryed with both
connexion links.

Revision history for this message
Marc Quinton (mquinton) wrote :

yes I think. I have not been able to reproduce the bug. All is OK now,
with original CUPS and also with your PPA. I have also tryed with both
connexion links.

Changed in cups (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

What additional information do you need?

Am 30.05.2012 23:03, schrieb Till Kamppeter:
> ** Changed in: cups (Ubuntu)
> Status: Confirmed => Incomplete
>

Revision history for this message
Till Kamppeter (till-kamppeter) wrote : Re: Printing stalls with "rendering completed"

Jan, sorry, must be "Confirmed".

Changed in cups (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
garybrlow (garybrlow) wrote :

I confirm this. I have an Epson T13 and all the pdf files generated from vectors done with inkscape are not printed at all. Instead I get the rendering complete message.

Revision history for this message
garybrlow (garybrlow) wrote :
Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote : Re: [Bug 998156] Re: Printing stalls with "rendering completed"

My dad just got an HP OfficeJet 6500A which is connected via USB to his
Ubuntu 12.04 amd64 box. He gets the same message there.

Am 07.06.2012 17:45, schrieb garybrlow:
> I confirm this. I have an Epson T13 and all the pdf files generated from
> vectors done with inkscape are not printed at all. Instead I get the
> rendering complete message.
>

Revision history for this message
Matthew Gregg (mcg) wrote : Re: Printing stalls with "rendering completed"

I have a USB connected HP6450 doing this. Working fine until 12.04.

Revision history for this message
Qian (qianian) wrote :

Similarly I have a USB-connected HP 1050 that started doing this between jobs from gimp, high-res color. All I did was reconnect the printer power supply and restart the printer. No updates or computer restarts.

I got the CUPS packages and reinstalled the printer twice. The only progress was with deletion and reinstall, test pages printed.

In case there are helpful replies I've posted to http://www.linuxquestions.org/questions/ubuntu-63/12-04-usb-printer-suddenly-stalls-rendering-completed-4175411133/

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

Everyone with this problem, please follow the instructions of the sections "CUPS error_log" and "Capturing print job data" on https://wiki.ubuntu.com/DebuggingPrintingProblems. Also check for lines containing "segfault" or "audit" in /var/log/syslog and post them if they are there. If there are "audit" lines, run the command

aa-complain cupsd

in a terminal window and check whether you can print now.

Changed in cups (Ubuntu):
status: Confirmed → Incomplete
Changed in cups (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Qian (qianian) wrote :
Revision history for this message
Qian (qianian) wrote :

PDF file with no errors (printout from gimp)

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

Qian, the problem is GIMP, it sends the attribute for a custom page size incorrectly. In this line in the error_log one sees it:

D [13/Jun/2012:10:42:06 -0700] [Job 153] argv[5]="InputSlot=Auto number-up=1 PageSize=Custom.Custom.396.00x720.00 MediaType=Plain OutputMode=Best ColorModel=RGB job-uuid=urn:uuid:ca56ecae-ec4e-3296-7723-0c4263d1f1ac job-originating-host-name=localhost time-at-creation=1339609326 time-at-processing=1339609326"

It sens "PageSize=Custom.Custom.396.00x720.00" and it must be "PageSize=Custom.396.00x720.00". This leads to Ghostscript being called with zero page size:

D [13/Jun/2012:10:42:08 -0700] [Job 153] Ghostscript command line: /usr/bin/gs -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -sDEVICE=cups -sstdout=%stderr -sOutputFile=%stdout -sMediaType=Plain -sOutputType=1 -r600x600 -dMediaPosition=7 -dDEVICEWIDTHPOINTS=0 -dDEVICEHEIGHTPOINTS=0 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=17 -scupsPageSizeName=Custom -I/usr/share/cups/fonts -c -f -_

and therefore Ghostscript errors out.

Adding GIMP task ...

Changed in gimp (Ubuntu):
importance: Undecided → High
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Jan, Matthew, can you follow my instructions in comment #20? Thanks.

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

garybrlow, the Inkscape problem is indeed bug 975972, please follow the discussion there.

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

Error occurs only after re-enabling the printer queue, i.e. starting the print job and getting the spool file is fine, but after re-enabling the queue it switches to "rendering completed". I tried to print from Shotwell, but in the past, printing also failed e.g. from Firefox.

error_log attached. (There are two "Photosmart" printer queues in there, the one in question is the one starting with "HP".)

Till, is there any possibility to send you the spool file by mail? I'd rather not post it here publicly (it's a photo of my wife and our baby). I can provide you with an Ubuntu One link.

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

Jan, can you please send me the error_log in debug mode? Please follow the instructions of the section "CUPS error_log" on https://wiki.ubuntu.com/DebuggingPrintingProblems.

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

Here you go. My fault!

I'll send you the corresponding spool file via mail.

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

Jan, did you try to print your photo with the GIMP, your print job was sent with the same broken "PageSize=Custom.Custom.283.46x425.20" attribute as Qian's job. See comment 23.

Do you have problems with other applications than with the GIMP? In this case please sent a spool file and an error_log of that situation. Do you also have problems with other files than photos?

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

I didn't print from GIMP; the output I provided was created by printing a photo from Shotwell. This error has also occured in Firefox -- see attachments.

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :
Revision history for this message
Qian (qianian) wrote :

Another unexpected sequence: I successfully printed the same graphic, same custom paper size settings, and from a file exported form gimp as jpeg, from Evince ONCE. I don't remember what else I changed but I have not been able to repeat this. Here are the files from printing from Evince.

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

Looks very much that the GTK printing dialog is broken, but to be sure let us check whether there is nothing odd in your config files.

Can you attach the following files

~/.cups/lpoptions
/etc/cups/lpoptions
/etc/cups/printers.conf
/etc/cups/ppd/HP-Photosmart-b109a-m.ppd

Did you select a custom page size in the printing dialog of any application?

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

Qian, Job 155 has a correct specification of the custom paper size. Which program and which settings did you use for that job?

There are other successful jobs, but they seem to be Letter-sized PDF files printed with evince.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gimp (Ubuntu):
status: New → Confirmed
Changed in gtk+3.0 (Ubuntu):
status: New → Confirmed
Changed in cups (Ubuntu):
status: Incomplete → Invalid
summary: - Printing stalls with "rendering completed"
+ GTK Print dialog sends broken custom page size attribute:
+ "PageSize=Custom.Custom.<width>x<length>"
Revision history for this message
Qian (qianian) wrote :

Till, I confirm that Evince prints with letter size settings but not the custom size ones. I'm using this as a clumsy workaround.

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

I can reproduce this bug by printing from the GIMP with a custom page size (create one and select it, not simply select "Custom"). The job is sent with the broken PageSize attribute and Ghostscript errors out.

Adding GTK task and closing CUPS task ...

Revision history for this message
Qian (qianian) wrote :

In case you still need those files, I don't see a .cups/ in ~/ or cups/ in /etc/

Here's the lpoptions from /usr/bin/

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

Qian, thank you very much, but I do not need the files any more. Also note that /usr/bin/ does not contain config files. There are only executables and they are the same for all users of the same version of Ubuntu.

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote : Re: [Bug 998156] Re: GTK Print dialog sends broken custom page size attribute: "PageSize=Custom.Custom.<width>x<length>"

Till, the second file I sent you is from a plain vanilla print job in
Firefox on system default paper size. On my dad's machine I could
"break" printing from LibreOffice without having to select any printing
options.

Please reconsider closing the CUPS task.

Am 14.06.2012 01:18, schrieb Till Kamppeter:
> I can reproduce this bug by printing from the GIMP with a custom page
> size (create one and select it, not simply select "Custom"). The job is
> sent with the broken PageSize attribute and Ghostscript errors out.
>
> Adding GTK task and closing CUPS task ...
>

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

Jan, can you attach the error_log of this job (also telling the job number)? All error_log files I got up to now have the "PageSize=Custom.Custom...." problem.

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

Till, I did the following experiment:
- Print a page from Firefox to my HP printer without changing any of the printer defaults (job 445). This will stall with "rendering completed" after starting the printer.
- Print a page from Firefox to CUPS-PDF without changing any of the printer defaults (job 446). This works fine.
- Print the PDF output from Evince to HP printer (job 446). This also works fine.

Please find the spool files and error logs in the enclosed tar archive.

So far I've been experiencing this bug with Firefox, Shotwell and LibreOffice. It started after upgrading to 12.04. My dad's machine is a fresh 12.04 install (moving from 32 to 64 bit). No problems with Thunderbird so far.

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

Oops, the last print experiment (Evince to HP printer) is job 447, of course.

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

Jan, thank you for the tests. Firefox has sent the "PageSize=Custom.Custom...." in both job 445 and 446, the difference is that the filter chain for the HP driver breaks on it but the filter chain for cups-pdf not. Evince does not send the broken PageSize attribute and therefore prints correctly.

This means that the bug is either in Firefox or GTK.

CUPS and the drivers are OK. They do not need to accept "PageSize=Custom.Custom....".

Changed in gtk+3.0 (Ubuntu):
importance: Undecided → High
Changed in firefox (Ubuntu):
importance: Undecided → High
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Important note to the GIMP, Firefox, and GTK maintainers: Jan's Firefox jobs have sent the "PageSize=Custom.Custom...." even with a standard page size (A4) selected.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in firefox (Ubuntu):
status: New → Confirmed
Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

No fix released yet. Printing still broken in an *LTS* release. :-(

Changed in firefox (Ubuntu):
milestone: none → ubuntu-12.04.1
Changed in gimp (Ubuntu):
milestone: none → ubuntu-12.04.1
Changed in gtk+3.0 (Ubuntu):
milestone: none → ubuntu-12.04.1
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Probably bug 996113 is the same bug.

no longer affects: cups (Ubuntu)
no longer affects: cups (Ubuntu Precise)
no longer affects: cups (Ubuntu Quantal)
Changed in firefox (Ubuntu Precise):
status: New → Confirmed
Changed in gimp (Ubuntu Precise):
status: New → Confirmed
Changed in gtk+3.0 (Ubuntu Precise):
status: New → Confirmed
Changed in firefox (Ubuntu Precise):
importance: Undecided → High
Changed in gimp (Ubuntu Precise):
importance: Undecided → High
Changed in gtk+3.0 (Ubuntu Precise):
importance: Undecided → High
Changed in firefox (Ubuntu Precise):
milestone: none → ubuntu-12.04.1
Changed in firefox (Ubuntu Quantal):
milestone: ubuntu-12.04.1 → none
Changed in gimp (Ubuntu Quantal):
milestone: ubuntu-12.04.1 → none
Changed in gtk+3.0 (Ubuntu Quantal):
milestone: ubuntu-12.04.1 → none
Changed in gtk+3.0 (Ubuntu Precise):
milestone: none → ubuntu-12.04.1
Changed in gimp (Ubuntu Precise):
milestone: none → ubuntu-12.04.1
Revision history for this message
Sebastien Bacher (seb128) wrote :

Till, could you upstream this bug to GTK upstream? Do you have steps to trigger the issue (that would make easier to debug)?

Changed in gimp (Ubuntu Quantal):
assignee: nobody → Till Kamppeter (till-kamppeter)
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Seb, in any application with GTK printing dialog try to print with a custom paper size:

Run the command

cupsctl LogLevel=debug

File/Print, in dialog select printer on "General" tab, switch to "Page Setup" tab, click on paper size drop down and choose "Manage Custom Sizes ...". Create a custom paper size. Now choose the newly created custom size and print.

In /var/log/cups/error_log You will find a line like

D [13/Jul/2012:19:24:49 +0200] [Job 626] argv[5]="InputSlot=Default PageSize=Custom.Custom.595.28x841.89 Duplex=None PrintoutMode=Normal PrinterResolution=FromPrintoutMode number-up=1 job-uuid=urn:uuid:bd2f3351-a345-3abb-63d9-ea13d11a8f39 job-originating-host-name=localhost time-at-creation=1342200218 time-at-processing=1342200289"

Note the "PageSize=Custom.Custom.595.28x841.89" in the line.

For some programs (like Firefox for some users) it can even happen with regular paper sizes, but with custom sizes it occurs for sure.

I have tested with Thunderbird on up-to-date Precise now and reproduced it as described above.

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

Seb, done. See GTK+ task.

Changed in gimp (Ubuntu Quantal):
assignee: Till Kamppeter (till-kamppeter) → nobody
Changed in gtk:
importance: Unknown → Critical
status: Unknown → New
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

In bug 973270, comment #74 and comment #75 a very similar problem is reported: When printing from Inkscape or evince the jobs get sent with an "PageSize=Custom.BrA3_S" attribute. Perhaps it is caused by the same bug but with a regular page size chosen.

Revision history for this message
Evertjan Garretsen (egarretsen) wrote :

I experience a bug similar to the one descriped above. Due to a wrong setting of paper-size A3 in the print dialog instead of A4. My printer HP CP1515CN does not support A3 paper format and i should not be able to select this size (correct me if wrong). When trying to print, the graphical spool just says: "stopped". HPLIP reports "job completed". The cups error_log is attached here. I have another printer the Brother MFC 5890CN which does support A3. It seems like the page setting of A3 was left from when i printed with this brother printer some time ago. Since then i could not print due to the bug 973270, so i only start noticing it now. I think hower that in case of errors in the error log, the graphical spool should say something more informative than "stopped", something like error. Maybe this bring you guys closer to solving this problem. After setting the correct size of A4 i was able to print again from Evince.

Revision history for this message
Evertjan Garretsen (egarretsen) wrote :

From within Inkscape i cannot print. I think this has to do with me not being able to select the "paper size" (Papiergroote) of A4. Somehow it is set to custom, although i've set my paper size to "A4" in the inkscape document. See the attached screenshot to see that the "paper size" field is disabled. I will als include a screenshot of the graphical print spool (don't know what it's called) so that you can see that the status is "stopped" (Gestopt).

Revision history for this message
Evertjan Garretsen (egarretsen) wrote :
Revision history for this message
Evertjan Garretsen (egarretsen) wrote :
Revision history for this message
Evertjan Garretsen (egarretsen) wrote :

One more screen shot. After a print does not succeed, probably due to incorrect or "custom" paper size after reopening the print dialog the printer's status is marked as "failed" as shown in the attached screenshot.

Revision history for this message
Evertjan Garretsen (egarretsen) wrote :

@till should this bug be marked as also affecting Inkscape?

Changed in inkscape (Ubuntu Precise):
importance: Undecided → High
status: New → Confirmed
milestone: none → ubuntu-12.04.1
Changed in inkscape (Ubuntu Quantal):
importance: Undecided → High
status: New → Confirmed
Changed in firefox (Ubuntu Precise):
milestone: ubuntu-12.04.1 → ubuntu-12.04.2
Changed in gimp (Ubuntu Precise):
milestone: ubuntu-12.04.1 → ubuntu-12.04.2
Changed in gtk+3.0 (Ubuntu Precise):
milestone: ubuntu-12.04.1 → ubuntu-12.04.2
Changed in inkscape (Ubuntu Precise):
milestone: ubuntu-12.04.1 → ubuntu-12.04.2
Revision history for this message
TJ (tj) wrote :

This also affects Evince and Gedit.

I discovered the bug whilst trying to print using Evince to a custom page size (A4 but with a 40mm left border) which I called "Sunshine Border".
Both preview and printing either fail or sometimes print using default A4 margins. I was trying to track down the cause for that inconsistency and followed a bug-trail to this report.

I compared Evince against Gedit. After selecting the custom size in the Print dialog (in my case "Sunshine Border) I found Gedit's preview will show the 40mm border, but printing fails...
... UNLESS I have previously used the CUPS printer administration to set the default page-size to 'Custom' and entered the 210x297 millimetre values.

http://localhost:631/admin/

> Printers > DESKJET-995C > Administration > Set Default Options... > Media Size = "Custom", Width=210, Height=297, Units=Millimeters > Set Default Options.

I noticed in CUPS error_log that PageSize wasn't 0x0 for me (only get that when selecting "Custom" when the size hasn't been configured in CUPS administrator):

PageSize=Custom.Custom.595.28x841.89

At first I thought this was in millimeters and is wrong, but then realised the units are points (1 PostScript point = 0.352777778 millimetres).

So, in summary:

Gedit: Can print using custom paper size as long as CUPS default custom size is also configured, and custom margins are honoured.
Evince: Can print using custom paper size as long as CUPS default custom size is also configured, but custom margins are ignored.

Revision history for this message
TJ (tj) wrote :

In modules/printbackends/cups/gtkprintbackendcups.c:

 static void
 add_cups_options (const gchar *key,
    const gchar *value,
    gpointer user_data)
 {
 ...
   /* Add "Custom." prefix to custom values. */
   if (custom_value)
    {
      new_value = g_strdup_printf ("Custom.%s", value);
      gtk_cups_request_encode_option (request, key, new_value);
      g_free (new_value);
    }
   else
    gtk_cups_request_encode_option (request, key, value);
 }

This is called from:

 static void gtk_print_backend_cups_print_stream (...) {
 ...
  gtk_print_settings_foreach (settings, add_cups_options, options_data);
 ...
 }

which is called via the ops pointer print_stream:

 backend_class->print_stream = gtk_print_backend_cups_print_stream;

The "Custom." code was added:

commit 8170436e61ea68c713d75ad374d22c3261be9203
Author: Benjamin Berg <email address hidden>
Date: Sat Dec 24 17:26:32 2011 +0100

    Set cups Custom print options correctly (bug #543520, patch by Marek Kašík)

    This patch fixes the cups print backend to pass Custom options with
    the "Custom." prefix to cups if neccessary.

https://bugzilla.gnome.org/show_bug.cgi?id=543520

In comment nos. 25 and 27 of that report Benjamin Berg describes this "Custom." prefix problem and a patch to remove it when the GTK+ print dialog. Commit 8170436e61ea68 was found to cause a crash in Thunderbird and Inkscape, and was subsequently revised by commit 9afe13bf91.

commit 9afe13bf91d8e80c4def7d3944d56542ce13733f
Author: Marek Kasik <email address hidden>
Date: Tue Jan 31 12:15:43 2012 +0100

    printing: Don't crash when printing

    This commit fixes crash which occurs in Firefox, Thunderbird and Inkscape
    during printing. This crash was caused because of wrong handling of Custom
    CUPS options. (#543520)

These commits are included in Ubuntu's 3.4.2 release.

My suspicion is that this code in create_pickone_option () {
...
      if (option->type != GTK_PRINTER_OPTION_TYPE_PICKONE)
        {
          if (g_str_has_prefix (ppd_option->defchoice, "Custom."))
            gtk_printer_option_set (option, ppd_option->defchoice + 7);
          else
            gtk_printer_option_set (option, ppd_option->defchoice);
        }
      else
...
}

isn't being executed in some circumstances, leading to the "Custom." prefix received from CUPS then being further prefixed by add_cups_options() when the ->print_stream op is called.

Revision history for this message
TJ (tj) wrote :

Here's confirmation obtained using gdb with evince:

Breakpoint 5, add_cups_options (key=0x7faa10a346b0 "cups-PageSize", value=0x7faa11235a20 "Custom.595.28x841.89",
    user_data=0x7faa11041090) at /build/buildd/gtk+3.0-3.4.2/./modules/printbackends/cups/gtkprintbackendcups.c:521
521 in /build/buildd/gtk+3.0-3.4.2/./modules/printbackends/cups/gtkprintbackendcups.c
...
Breakpoint 6, add_cups_options (key=0x7faa10a346b5 "PageSize", value=<optimized out>, user_data=<optimized out>)
    at /build/buildd/gtk+3.0-3.4.2/./modules/printbackends/cups/gtkprintbackendcups.c:568
568 new_value = g_strdup_printf ("Custom.%s", value);
(gdb) print new_value
$2 = (gchar *) 0x0
(gdb) n
568 new_value = g_strdup_printf ("Custom.%s", value);
(gdb) n
569 gtk_cups_request_encode_option (request, key, new_value);
(gdb) print new_value
$3 = (gchar *) 0x7faa10914000 "Custom.Custom.595.28x841.89"

TJ (tj)
Changed in gtk+3.0 (Ubuntu Precise):
assignee: nobody → TJ (intuitivenipple)
status: Confirmed → In Progress
Revision history for this message
TJ (tj) wrote :

I created a fix and tested it successfully:

Breakpoint 2, add_cups_options (key=0x7fe101636ca0 "cups-PageSize", value=0x7fe101636c80 "Custom.595.28x841.89",
    user_data=0x7fe1014c6970) at /home/all/SourceCode/gtk/gtk+3.0-3.4.2/./modules/printbackends/cups/gtkprintbackendcups.c:521
521 {
(gdb) c
Continuing.

Breakpoint 3, add_cups_options (key=0x7fe101636ca5 "PageSize", value=<optimized out>, user_data=<optimized out>)
    at /home/all/SourceCode/gtk/gtk+3.0-3.4.2/./modules/printbackends/cups/gtkprintbackendcups.c:566
566 if (custom_value && !g_str_has_prefix(value, "Custom."))
(gdb) n
573 gtk_cups_request_encode_option (request, key, value);
(gdb) c
Continuing.

The fix simply checks whether the value already has the "Custom." prefix and if so, doesn't insert it again. In the code above the test !g_str_has_prefix(value, "Custom.") fails and processing goes through the 'else' clause on line 573.

- /* Add "Custom." prefix to custom values. */
- if (custom_value)
+ /* Add "Custom." prefix to custom values (if they don't already have the prefix). */
+ if (custom_value && !g_str_has_prefix(value, "Custom."))

A debdiff (for Precise) is attached.

Changed in gtk+3.0 (Ubuntu Precise):
assignee: TJ (intuitivenipple) → nobody
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Precise debdiff - gtk+3.0 - do not duplicate CUPS "Custom."" of this bug report has been identified as being a patch in the form of a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
psamuel (persaudsamuel) wrote :

he tenido este mismo problema cuando usaba la version 12.04 de ubuntu

tags: added: rls-q-incoming
Bryce Harrington (bryce)
description: updated
Changed in gtk+2.0 (Debian):
status: Unknown → Confirmed
tags: removed: rls-q-incoming
Revision history for this message
Micah Gersten (micahg) wrote :

larsu commented on IRC in #ubuntu-desktop that the patch fixes the issue, but wasn't the right solution and said he'd take a look this week, unsubscribing ubuntu-sponsors for the moment as there's nothing to sponsor

tags: added: patch-needswork
removed: patch
Revision history for this message
Panayiotis Karabassis (panayk) wrote :

I am also affect by this bug: https://bugs.launchpad.net/hplip/+bug/1045486

I am not using a custom paper size at all, but "A4.AutoDuplex" (which is changed to Custom.Custom.595.28x841.89) , so the above patch does not help me. The numbers 595.28x841.89 do not appear in my PPD at all.

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

Downgrading the quantal tasks to medium as they can't be a release blocker as already present in quantal. Till will continue to work on it though (asked on IRC)

Changed in firefox (Ubuntu Quantal):
importance: High → Medium
Changed in gimp (Ubuntu Quantal):
importance: High → Medium
Changed in gtk+3.0 (Ubuntu Quantal):
importance: High → Medium
Changed in inkscape (Ubuntu Quantal):
importance: High → Medium
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

14:18:45 larsu | didrocks, I asked mkasik's opinion about the attached patch, but he hasn't answered yet
14:18:53 larsu | (he's the one doing printing in gtk)
14:19:17 didrocks | larsu: ah, should we try it in quantal? or can you try to ping him again?
14:19:33 larsu | didrocks, I think the patch is not good enough for upstream, but it will do the job for a cycle if we don't get a
                   | real fix soon
14:19:59 larsu | the patch almost certainly works, it's just not doing the right thing
14:20:00 didrocks | larsu: maybe not beta2 though? should we just fiddle it in after it? (so that easier to revert)
14:20:10 larsu | yeah let's do that
14:20:14 didrocks | ok, gotcha :)

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

Sorry, I was AFK, it seems that the patch on the upstream bug got accepted, so we should take the patch from that bug (https://bugzilla.gnome.org/show_bug.cgi?id=679883) into Ubuntu's GTK+3.0 package.

Is this all to fix this bug? Or is there anything to do on GIMP, Inkscape, and Firefox?

Changed in gtk+3.0 (Ubuntu Quantal):
status: Confirmed → Triaged
Changed in gtk:
status: New → Fix Released
Revision history for this message
su_v (suv-lp) wrote :

Till Kamppeter wrote:
> (…) we should take the patch from that bug (…) into Ubuntu's
> GTK+3.0 package.
>
> Is this all to fix this bug? Or is there anything to do on GIMP, Inkscape,
> and Firefox?

At least Inkscape and GIMP are still GTK2 apps - AFAIU a change in the cups printbackend in (upstream) GTK3 doesn't fix printing for them. Could you help with getting the fix backported upstream to Gtk+ 2.24?

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

Added gtk+2.0 task as many important applications in Ubuntu (Inkscape, GIMP, Firefox, Thunderbird, ...) are still based on GTK 2. So it is really important to apply the fix also there. This should not be too complicated as the print dialog did not change much between GTK 2 and GTK 3. Note that the fix is especially important as Inkscape and GIMP are typical applications from which one prints on custom paper sizes.

Changed in gtk+2.0 (Ubuntu Quantal):
importance: Undecided → High
milestone: none → ubuntu-12.10
status: New → Confirmed
Changed in gtk+2.0 (Ubuntu Precise):
importance: Undecided → High
milestone: none → precise-updates
status: New → Confirmed
Revision history for this message
Iain Lane (laney) wrote :

Marked the app tasks as Invalid, as it looks like this is a GTK problem.

Changed in gimp (Ubuntu Precise):
status: Confirmed → Invalid
Changed in gimp (Ubuntu Quantal):
status: Confirmed → Invalid
Changed in gtk+2.0 (Ubuntu Precise):
status: Confirmed → Invalid
Changed in gtk+2.0 (Ubuntu Quantal):
status: Confirmed → Invalid
Changed in inkscape (Ubuntu Precise):
status: Confirmed → Invalid
Changed in inkscape (Ubuntu Quantal):
status: Confirmed → Invalid
Changed in firefox (Ubuntu Quantal):
status: Confirmed → Invalid
Changed in firefox (Ubuntu Precise):
status: Confirmed → Invalid
Changed in gtk+2.0 (Ubuntu Quantal):
status: Invalid → Triaged
Changed in gtk+2.0 (Ubuntu Precise):
status: Invalid → Triaged
Revision history for this message
Ted Gould (ted) wrote :

This was in 3.6.0

Changed in gtk+3.0 (Ubuntu Quantal):
status: Triaged → Fix Released
Changed in gtk+2.0 (Ubuntu Quantal):
assignee: nobody → Ted Gould (ted)
status: Triaged → In Progress
Changed in gtk+2.0 (Ubuntu Quantal):
milestone: ubuntu-12.10 → quantal-updates
Colin Watson (cjwatson)
Changed in gtk+3.0 (Ubuntu Precise):
milestone: ubuntu-12.04.2 → ubuntu-12.04.3
Revision history for this message
Andrew Piziali (bj7u6139zdy-andy) wrote :

For several hours I have been attempting to print a JPEG image from GIMP on 4x6 photo paper using an HP Photosmart Premium All-in-One. After adding a custom paper size named "Photo Borderless 4x6" in the GIMP print dialog box, each attempt to print the image resulted in CUPS hung with "rendering completed," as described earlier by others.

I have also attempted to print the image using Eye of Gnome (eog) and Evince with the same result.

What work-around exists for a user to simply print an image on 4x6 photo paper, since that paper size is not installed by default in Ubuntu 12.10?

Thank you.

Revision history for this message
Jan Heitkötter (jan-heitkoetter) wrote :

In my case, printing to PDF in the first place and then printing that PDF to printer worked.

This is a bug tracker -- please address further "how to" questions in the forums.

Revision history for this message
bitsparrow (bitsparrow) wrote :

I've the same bad problem with Inkscape Inkscape 0.48.4-27 on Ubuntu 12.04.3 kernel 3.5.x. In practice as the other people here, I can't print anything on inkscape. Naturally, only if export in png or pdf i can print the project not directly with inkscape.

Ted Gould (ted)
Changed in gtk+2.0 (Ubuntu Quantal):
assignee: Ted Gould (ted) → nobody
affects: gtk+2.0 (Ubuntu) → ubuntu
Changed in ubuntu:
assignee: Ted Gould (ted) → nobody
Revision history for this message
Jens-r (jensr) wrote :
Revision history for this message
Rolf Leggewie (r0lf) wrote :

quantal has seen the end of its life and is no longer receiving any updates. Marking the quantal task for this ticket as "Won't Fix".

anil (aneelpace)
Changed in gimp (Ubuntu):
assignee: nobody → anil (aneelpace)
status: Invalid → Confirmed
Changed in gtk+2.0 (Debian):
status: Confirmed → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote :

The Precise Pangolin has reached end of life, so this bug will not be fixed for that release

Changed in gtk+3.0 (Ubuntu Precise):
status: In Progress → Won't Fix
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.