Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long edge / Short edge printing bug with cups 2.4.8 #952

Open
HROMANO opened this issue May 1, 2024 · 18 comments
Open

Long edge / Short edge printing bug with cups 2.4.8 #952

HROMANO opened this issue May 1, 2024 · 18 comments
Labels
waiting for reporter There are data requested from the reporter

Comments

@HROMANO
Copy link

HROMANO commented May 1, 2024

Describe the bug
With cups 2.4.8, whatever I choose 'Long edge' or 'Short edge', I get a 'Short Edge' print.
When I downgrade to cups 2.4.7, the choices work as usual.

System Information:

  • Archlinux (up to date)
  • Evince, Libreoffice
  • CUPS 2.4.8

Additional context
The printer is a network driverless printer (IPPS)
Model HP ENVY 6032e

@zdohnal
Copy link
Member

zdohnal commented May 17, 2024

Hi,

thank you for reporting the issue!

Would you mind turning on debug logging for CUPS, reproduce the issue and then attach file with logs here?

Thank you in advance!

@zdohnal zdohnal added the waiting for reporter There are data requested from the reporter label May 17, 2024
@HROMANO
Copy link
Author

HROMANO commented May 17, 2024

This is /var/log/cups/error.log after enabling debug logging.

The faulty print is [Job 1072], starting at around [17/May/2024:13:14:21 +0200].

error_log

@zdohnal
Copy link
Member

zdohnal commented May 17, 2024

Hmm, both app and IPP backend sends the correct option and value - I've tested it with my home printer and Fedora 39 + CUPS 2.4.8, and DuplexNoTumble was applied well...

Is you printer installed as permanent queue? If it is, can you reinstall the queue, and attach its PPD file from /etc/cups/ppd.

@michaelrsweet I don't recall we did something regarding duplex...

@michaelrsweet
Copy link
Member

@zdohnal No we haven't touched the duplex handling code in a long time...

@HROMANO
Copy link
Author

HROMANO commented May 17, 2024

I'm not sure what you mean with 'permanent queue'. The printer is auto discovered (avahi I suppose) and I didn't installed it specifically.

@zdohnal
Copy link
Member

zdohnal commented May 20, 2024

@HROMANO

If you run lpstat -l -e, it lists available destinations, where the second word is the type of installation. The permanent queues are marked permanent, auto discovered/temporary ones are marked as network. Can you shared the output of the command?

@HROMANO
Copy link
Author

HROMANO commented May 20, 2024

Yes, it's not a permanent queue:

GARAGE_AIRPRINT network none ipps://GARAGE_AIRPRINT._ipps._tcp.local/
HP_ENVY_6000_series_5493E7 network none ipps://HP%20ENVY%206000%20series%20%5B5493E7%5D._ipps._tcp.local/

(first printer. The second is my wife's printer, same model and same problem).

@zdohnal
Copy link
Member

zdohnal commented May 21, 2024

Ok - can you check whether cups-browsed is running and show printer options?

$ systemctl is-active cups-browsed
$ lpoptions -p GARAGE_AIRPRINT -l
$ lpoptions -p GARAGE_AIRPRINT

It would help to see screenshot of problematic and successful printing as well + CUPS debug log for older CUPS.

I hope I can see some difference between them to realize what is the problem, because I don't see the issue on any of my work printers...

@HROMANO
Copy link
Author

HROMANO commented May 21, 2024

Here are the first results:

  • Cups 2.4.7
systemctl is-active cups-browsed

inactive

lpoptions -p GARAGE_AIRPRINT -l

PageSize/Media Size: 100x150mm 100x150mm.Borderless 3.5x5 3.5x5.Borderless 4x6 4x6.Borderless 5x7 5x7.Borderless 5x8 5x8.Borderless 8x10 8x10.Borderless *A4 A4.Borderless A5 A5.Borderless A6 A6.Borderless B5 B5.Borderless Env10 EnvC6 EnvChou3 EnvChou4 EnvDL Executive ISOB5 Letter Letter.Borderless Postcard Postcard.Borderless Custom.WIDTHxHEIGHT
MediaType/Media Type: *Stationery PhotographicGlossy Com.hpSpecialtyGlossy Com.hpSpecialtyMatte StationeryLightweight
cupsPrintQuality/cupsPrintQuality: Draft *Normal High
ColorModel/Output Mode: *RGB Gray Gray16 DeviceGray DeviceRGB AdobeRGB
Duplex/Duplex: *None DuplexNoTumble DuplexTumble
OutputBin/OutputBin: *FaceUp

lpoptions -p GARAGE_AIRPRINT 

device-uri=ipps://GARAGE_AIRPRINT._ipps._tcp.local/ printer-info=GARAGE_AIRPRINT printer-location=Garage printer-make-and-model='HP ENVY 6000 series' printer-type=83890204
  • Cups 2.4.8:
systemctl is-active cups-browsed

inactive

lpoptions -p GARAGE_AIRPRINT -l

PageSize/Media Size: 100x150mm 100x150mm.Borderless 3.5x5 3.5x5.Borderless 4x6 4x6.Borderless 5x7 5x7.Borderless 5x8 5x8.Borderless 8x10 8x10.Borderless *A4 A4.Borderless A5 A5.Borderless A6 A6.Borderless B5 B5.Borderless Env10 EnvC6 EnvChou3 EnvChou4 EnvDL Executive ISOB5 Letter Letter.Borderless Postcard Postcard.Borderless Custom.WIDTHxHEIGHT
MediaType/Media Type: *Stationery PhotographicGlossy Com.hpSpecialtyGlossy Com.hpSpecialtyMatte StationeryLightweight
cupsPrintQuality/cupsPrintQuality: Draft *Normal High
ColorModel/Output Mode: *RGB Gray Gray16 DeviceGray DeviceRGB AdobeRGB
Duplex/Duplex: *None DuplexNoTumble DuplexTumble
OutputBin/OutputBin: *FaceUp

lpoptions -p GARAGE_AIRPRINT 

device-uri=ipps://GARAGE_AIRPRINT._ipps._tcp.local/ printer-info=GARAGE_AIRPRINT printer-location=Garage printer-make-and-model='HP ENVY 6000 series' printer-type=83890204

I'll try to provide the log later. But for screenshots, there's nothing different on the screen. I always have both choices in the combo box (long/short edge), it just always print short edge what ever I choose.

@zdohnal
Copy link
Member

zdohnal commented May 22, 2024

@HROMANO ahh, my bad - by screenshots I meant scans of printer outputs (printed papers) when you try to print DuplexNoTumble with 2.4.7 and 2.4.8 (original file would be great as well). Please create two pdf files with two page, where the first page shows the first page of the sheet, and the second the other page if you turn the sheet by long edge.

@zdohnal
Copy link
Member

zdohnal commented May 22, 2024

@HROMANO Ad provided data for now - good, I don't see any DuplexTumble (PPD option) or two-sided-short-edge (IPP attribute) in default settings which could override your options from application (they should appear in the log, but I wanted to be sure in case there is a bug which does not show it).

@HROMANO
Copy link
Author

HROMANO commented May 23, 2024

Here are the files:

  • Original PDF: cups.pdf

  • Scanned after printed with 2.4.7 (evince, long edge): cups247.pdf

  • Scanned after printed with 2.4.8 (evince, same parameters): cups248.pdf

Logs for 2.4.7 (Job 1106):

Logs for 2.4.8 (Job 1107):

I've cut the heads of the logs (previous days, jobs). Not sure how to exactly cut for error_log of 2.4.7 so the first lines are probably not interesting. error_log for 2.4.8 is cut just after the last line of error_log for 2.4.7.

Note: I rebooted between 2.4.7 and 2.4.8 to be sure to run the right version.

@HROMANO
Copy link
Author

HROMANO commented May 24, 2024

After bisecting between 2.4.7 and 2.4.8:

0736b61d800cdf866311a60f4b16e4b1fd38230e is the first bad commit
commit 0736b61d800cdf866311a60f4b16e4b1fd38230e (HEAD)
Author: Alexander Pevzner <[email protected]>
Date:   Sun Oct 22 22:07:20 2023 +0300

    cups/ppd-cache.c: Add cupsUrfSupported to generated PPD (see #804)
    
    It fixes driverless printing on Pantum BM5100ADW Series and, probably,
    on many other devices.
    
    - Without this parameter, /usr/lib/cups/filter/universal generates RGB
    image/urf even for monochrome printer
    - Pantum BM5100ADW Series rejects to print these RGB images with
    the "Print job canceled at printer" status.
    - Probably, this issue affects many other devices
    
    See #804 for details.

 cups/ppd-cache.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

I don't know what is Urf, but not a good idea for my printer…

@zdohnal
Copy link
Member

zdohnal commented May 27, 2024

Thank you for bisecting the code and the logs!

URF is a document format for AirPrint and cupsUrfSupported is PPD keyword for its IPP attribute equivalent - urf-supported - it contains printer capabilities which CUPS can take and present them to the user as options which can be applied to the job.

The keyword was added as part of #804 to work around issue in libcupsfilters, which looks to be fixed now. Probably adding the keyword into PPD file triggered an issue in libcupsfilters, which now I realize it is an issue:

D [23/May/2024:21:43:29 +0200] [Job 1107] Color space requested: Default
D [23/May/2024:21:43:29 +0200] [Job 1107] Final output format: Apple Raster
D [23/May/2024:21:43:29 +0200] [Job 1107] Color mode requested: auto; color depth requested: Standard
D [23/May/2024:21:43:29 +0200] [Job 1107] Determining best color space/depth ...
E [23/May/2024:21:43:29 +0200] [Job 1107] Unable to set color space/depth for Raster output!

The filter hits this error because CUPS now created cupsUrfSupported PPD option which libppd converts back to IPP attribute for ghostscript filter. There is even a difference in ghostscript command:

D [23/May/2024:21:43:29 +0200] [Job 1107] cfFilterGhostscript: Ghostscript command line: gs -dQUIET -dSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -dNOMEDIAATTRS -dUsePDFX3Profile -sstdout=%stderr -sOutputFile=%stdout -sDEVICE=appleraster -sMediaType=Stationery -dDuplex -r300x300 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=841 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=19 -scupsRenderingIntent=auto -scupsPageSizeName=A4 -scupsBackSideOrientation=Normal -dcupsManualCopies -I/usr/share/cups/fonts -sOutputICCProfile=srgb.icc -c \'<</.HWMargins[8.390552 8.390552 8.390564 8.390564] /Margins[0 0]>>setpagedevice\' -f -_

and for 2.4.7

D [23/May/2024:21:32:19 +0200] [Job 1105] cfFilterGhostscript: Ghostscript command line: gs -dQUIET -dSAFER -dNOPAUSE -dBATCH -dNOINTERPOLATE -dNOMEDIAATTRS -dUsePDFX3Profile -sstdout=%stderr -sOutputFile=%stdout -sDEVICE=appleraster -sMediaType=Stationery -sOutputType=automatic -dDuplex -r300x300 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=19 -dcupsBorderlessScalingFactor=0.0000 -dcupsInteger1=-1 -dcupsInteger2=-1 -dcupsInteger8=4 -scupsRenderingIntent=auto -scupsPageSizeName=A4 -scupsBackSideOrientation=Rotated -dcupsManualCopies -I/usr/share/cups/fonts -sOutputICCProfile=srgb.icc -c -f -_

I suspect -scupsBackSideOrientation different value is the reason of a different output.

Can you get me PPD file which is created at the moment when you print a file? The PPD will be located in /etc/cups/ppd for a minute and then disappears - I would like to check how cupsUrfSupported looks like for you.

Then it would be great if you ran:

$ ipptool --ippserver ipptool.attr ipp://HPA8B13B027068.local:631/ipp/print get-printer-attributes.test

and attached ipptool.attr here as attachment.

Those files will get me idea how urf-supported looks like and whether CUPS transfers it correctly - if the output is okay, then there is at least one issue regarding urf-supported in libcupsfilters...

@HROMANO
Copy link
Author

HROMANO commented May 27, 2024

Here are the files for 4.2.8:

@zdohnal
Copy link
Member

zdohnal commented May 28, 2024

Ok, we generate the cupsUrfSupported badly:

From IPP response:

ATTR keyword urf-supported "CP1","MT1-2-8-9-10-11","PQ3-4-5","RS300-600","SRGB24","OB9","OFU0","W8-16","DEVW8-16","DEVRGB24-48","ADOBERGB24-48","DM3","IS1","V1.5","FN3"

and what we create:

*cupsUrfSupported: "CP1,MT1-2-8-9-10-11PQ3-4-5RS300-600SRGB24OB9OFU0W8-16DEVW8-16DEVRGB24-48ADOBERGB24-48DM3IS1V1.5FN3"

not enough commas :) ... I'm sorry for that, I'll prepare the fix.

@zdohnal
Copy link
Member

zdohnal commented May 28, 2024

Are you able to compile CUPS with the following patch and check if your printer works as expected?

diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c
index 3650f40..d0ed94a 100644
--- a/cups/ppd-cache.c
+++ b/cups/ppd-cache.c
@@ -3511,7 +3511,7 @@ _ppdCreateFromIPP2(
     for (i = 0, count = ippGetCount(attr); i < count; i ++)
     {
       keyword = ippGetString(attr, i, NULL);
-      cupsFilePrintf(fp, "%s%s", keyword, i ? "" : ",");
+      cupsFilePrintf(fp, "%s%s", keyword, i != count - 1 ? "," : "");
     }
     cupsFilePuts(fp, "\"\n");
   }

@HROMANO
Copy link
Author

HROMANO commented May 28, 2024

It's good now with the patch. Thanks!

zdohnal added a commit to zdohnal/cups that referenced this issue May 29, 2024
The PPD keyword got the option values concatenated together without
commas, which broke filter processing in libcupsfilters

Sometimes more commas better commas :)
zdohnal added a commit to zdohnal/cups that referenced this issue May 29, 2024
The PPD keyword got the option values concatenated together without
commas, which broke filter processing in libcupsfilters

Sometimes more commas better commas :)
zdohnal added a commit that referenced this issue May 30, 2024
The PPD keyword got the option values concatenated together without commas, which broke filter processing in libcupsfilters

Sometimes more commas better commas :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for reporter There are data requested from the reporter
Projects
None yet
Development

No branches or pull requests

3 participants