OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
1.09k stars 195 forks source link

Printing test page does not work on Gentoo with CUPS 2.4.7 due distro packaging issue #904

Closed paboum closed 8 months ago

paboum commented 8 months ago

Before you write the report Read the REPORTING_ISSUES.md file in the main repository and prepare data mentioned there which looks relevant to you issue.

Yeah, nice read, so are the drivers supported, forbidden or what? Where is the migration tutorial?

Describe the bug After updating to 2.4.7 my printer doesn't print. Looking in cups admin panel, all jobs seem to have size 0 and "been cancelled" by someone, not me. I can't see relevant information in logs. Trying to print a test page yields "no such file or directory" message. Downgrading to 2.4.6 fixes all that.

To Reproduce Steps to reproduce the behavior:

  1. Buy a Samsung M2026W printer
  2. Use the official V1.00.39_01:17 driver as I did for the past 6 years.
  3. emerge -DuavN world, which gets cups 2.4.7 installed
  4. Try to print now

Expected behavior I would at least expect a clear error message, like telling me I need to use "driverless" thing and a migration manual on how to achieve this with my printer model (or vendor at least).

Screenshots Meh... maybe this helps?

localhost - - [04/Mar/2024:04:20:34 +0100] "POST /printers/Samsung_M2020_Series HTTP/1.1" 200 262 Create-Job successful-ok
localhost - - [04/Mar/2024:04:20:34 +0100] "POST /printers/Samsung_M2020_Series HTTP/1.1" 200 24197 Send-Document client-error-document-format-not-supported

Srsly, I didn't get any informative message from the tool, otherwise I would maybe investigate it myself further. For now it only says that drivers WILL be unsupported some day, thus I don't believe this is the issue now.

System Information:

Additional context I'm not really interested in installing the bad version again. Just want to continue using my printer and the project should employ best effort to facilitate that. If I need to change some settings, provide a script that does that, or a tutorial, or at least yield a meaningful error message.

zdohnal commented 8 months ago

Before you write the report Read the REPORTING_ISSUES.md file in the main repository and prepare data mentioned there which looks relevant to you issue.

Yeah, nice read, so are the drivers supported, forbidden or what? Where is the migration tutorial?

Looks like you haven't been able to read to the section, especially to the part about logs and other things like PPD file, driver you used (its version does not suffice) etc. Please provide such data.

Describe the bug After updating to 2.4.7 my printer doesn't print. Looking in cups admin panel, all jobs seem to have size 0 and "been cancelled" by someone, not me. I can't see relevant information in logs. Trying to print a test page yields "no such file or directory" message. Downgrading to 2.4.6 fixes all that.

Looks like a filter issue - 2.4.7 had some fixes regarding PPD file interpretation, otherwise I don't see anything in Changelog which would affect USB printing from the first glance. We could have seen more info from debug logs, if debug logging had been enabled, the issue had been reproduced with debug logs turned on, and the file had been attached. All is described in REPORTING_ISSUES document.

zdohnal commented 8 months ago

USB backend itself looks unaffected - I printed with classic driver via USB to my HP printer and it worked. Looks like a model specific issue.

paboum commented 8 months ago

USB backend itself looks unaffected - I printed with classic driver via USB to my HP printer and it worked. Looks like a model specific issue.

Still I cannot investigate this further without meaningful log output or clear procedure on how to upgrade on my side.

zdohnal commented 8 months ago

Please read the document REPORTING_ISSUES, do the steps mentioned there and provide the data you got (debug logs, PPD and others).

paboum commented 8 months ago

Please read the document REPORTING_ISSUES, do the steps mentioned there and provide the data you got (debug logs, PPD and others).

You must be mad? image I'm the issue reporter, not a paid QA engineer. Either fix the bug or leave your code broken. Idc, will use 2.4.6 forever or fork it myself.

paboum commented 8 months ago

Here, got it narrowed down for you: https://github.com/OpenPrinting/cups/compare/v2.4.6...v2.4.7

Apparently one of these is the culprit:

Just add the file I mentioned (here, I even attached it if it's too hard to fetch) to the automated tests battery you use (idc if you don't have one) and find out why these commits break it. I've already spent too much time on detailing this regression, other users will likely come here, comment on this issue, maybe one of them will be eager to perform QA tasks in order to get constructive error message (which should be displayed in the first place, leave alone auto-reporting issues which is the 21st century way of doing things).

Samsung_M2020_Series.ppd.txt

zdohnal commented 8 months ago

Ok, I've installed uld_V1.00.39_01.17.tar.gz from HP, installed your model and tried to print with it into a file.

I don't see any errors in my log and the output file is in QPDL format, which I don't have a way how to verify its contents. I've tried it with 2.4.6 and 2.4.7, both ends up with exactly the same file. Test page produces the output as well, all fine in the Web UI too (jobs are finished without error).

I can't do more without logs when issue happens, other information and further coordination, since I don't have the model in question.

Investigated those two commits - I don't see any obvious problems in them.

Closing for now until there is someone who provides the requested data.

paboum commented 8 months ago

Tricky one :/ I got it re-updated to 2.4.7 and were surprised it works (could print a test page on 2.4.7, and some documents too) for some reason during the past week. Got even thinking "silly me, making drama while it doesn't seem to reproduce".

Until today. Seems that maybe putting PC to sleep (ACPI S3 state) may change something? Nevertheless, I tried restarting cups which didn't help and this is the debug2 log all the fuss was about:

issue-904-bad.txt

As a bonus I also give you 2.4.6 log for comparison: issue-904-good.txt

(and so on, it's much longer than the former; XXX = redacted)

And my own observation of where the logs significantly differ. Yet, still nothing more informational than "No such file or directory". image

And also a note based on my experience, Gentoo devs for some reason decided that 2.4.6 and 2.4.7 ebuilds differ a lot. It may be the case they changed some dependencies to versions that you don't support. There are also lots of changes (mostly whitespace and more comments) to default cupsd.conf. There are even some new bugs related for that ebuild created in the past 2 weeks. Surely I can tell the package maintainer to join this thread.

EDIT zdohnal: put the logs into files, it is difficult to orient in issue where logs are in the comment as code blocks...

zdohnal commented 8 months ago

Ok, now when I see the logs (and gentoo cups git log :) ), I get where the error is - cups-filters dependency was removed - Gentoo Link , which provides files needed for test page, plus several filters needed for filtering on Linux.

Install it/put the dependency back again and it should work.

But I can see what can be improved - we can set the filename into error message - this would indicate sooner that some file is missing. I'll see what can I do about the error message.

zdohnal commented 8 months ago

To be completely precise - the files needed for test page are now in libcupsfilters, which is dependency of cups-filters - so adding cups-filters does the trick transitively.

paboum commented 8 months ago

Okay, it seems that what has changed in my case for the past week was running the depclean (which uninstalled cups-filters). And Gentoo devs had issued a news item regarding this, so what I had to do was installing cups-meta which will "hold" the filters. I guess there is no point in reporting a Gentoo bug now, however I would expect that the news item just tells me that some printers could stop printing without an apparent reason instead of apologetically bothering me with the package architecture.

2023-12-17-cups-filters
  Title                     CUPS no longer directly depends on its filters
  Author                    Eli Schwartz <eschwartz93@gmail.com>
  Posted                    2023-11-20
  Revision                  1

Reasons
=======

Historically, net-print/cups has both depended on and been a dependency of
net-print/cups-filters. The latter is required for usability of a CUPS
printing setup, but also must build against the former's libraries. This
results in an ugly dependency cycle, and forcing the entire CUPS printing
setup wherever USE=cups is enabled on a framework.

Current upstream work on CUPS has focused on modularizing the codebase. There
are now several packages, and there will be more in the future. Installing
net-print/cups-filters is no longer sufficient to ensure all components are
installed.

In the future, when CUPS v3 is released, filters will be exclusive to legacy
printers, and largely replaced with IPP Everywhere.[1]

A more future-proof way to install a CUPS production printing setup is needed.

User Action Required
=======

cups-filters is required for current versions of CUPS. To prevent depcleaning
if you are a CUPS user (and it was not installed just as a dependency for
something else):

    emerge net-print/cups-meta

If cups-browsed support is desired, add the following package.use:

    net-print/cups-meta browsed

[1] https://openprinting.github.io/current/#the-new-architecture-for-printing-and-scanning

The test page from 2.4.7 just to confirm:

cups

Yeah, printing which file is missing could definitely help. It's possible that any user just types the filename in Google and fixes the issue right away.

paboum commented 1 month ago

Ah, so you made me install vulnerable code, eh?

USE=-foomatic emerge -av1 cups-filters cups-meta

fixes the latest 9.9 CVSS.