OpenPrinting / cups-browsed

Apache License 2.0
33 stars 10 forks source link

"implicitclass" causes user-specified print settings in GTK applications to be silently overriden/ignored #15

Open sjmks opened 1 year ago

sjmks commented 1 year ago

I reported an issue in the GNOME/GTK forums related to a serious basic network printing problem involving CUPS, where printing from any GTK application would result in overriding of user-specified print settings (either the system settings would silently override the user-specified settings—like duplex-vs-simplex or color-vs-monochrome printing—or other unexpected and seemingly random things would occur, like printing on massive-sized paper when that is not specified anywhere).

I tracked it down to be related to implicitclasses in the CUPS protocol.

Could you please work with the GTK people to resolve this issue (or else help to determine if it just needs to be addressed on one side vs the other)? I've tried disabling ImplicitClasses in cupsd.conf, but it doesn't seem to help.

Here is the issue as I reported it in GNOME GitLab: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2463

Thank you in advance. It is a serious problem for network printing and does not help in efforts to make Enterprise Linux Desktop viable and reputable.

zdohnal commented 1 year ago

Hi,

implicitclass backend is part of cups-browsed project, which is under OpenPrinting, but not part of CUPS.

I reported an issue in the GNOME/GTK forums related to a serious basic network printing problem involving CUPS, where printing from any GTK application would result in overriding of user-specified print settings (either the system settings would silently override the user-specified settings—like duplex-vs-simplex or color-vs-monochrome printing—or other unexpected and seemingly random things would occur, like printing on massive-sized paper when that is not specified anywhere).

My personal guess is that GTK is still using CUPS-Add-Modify-Printer for changing PPD defaults, which rewrites PPD file on disk and requires additional permissions - cups-browsed is implemented in a way to generate PPD every time when the printer is up, so the changes made by GTK are lost once the cups-browsed removes the printer (once printer is turned off/cups-browsed is turned off/network disappears...). There is cupsSetDests2() function, which saves the user-defined options into user's home directory (thus the execution does not need more rights) and it is applied every time the printer shows up - that would do the trick for GTK apps.

I tracked it down to be related to implicitclasses in the CUPS protocol.

Could you please work with the GTK people to resolve this issue (or else help to determine if it just needs to be addressed on one side vs the other)?

I'll pass this to cups-browsed project for further investigation, but from my POV there are three ways how to deal with it (some depend on your setup):

  1. GTK apps will start using cupsSetDests()/cupsSetDests2() which will work not only for implicitclass, but for temporary queues as well - ideal case, because it will prepare GTK apps for the future without PPDs,
  2. you will turn off/restrict cups-browsed, and use temporary queues (automatically detected queues via mDNS, which you don't have to install via gnome-control-center and they appear right for the print dialog and disappear after printing, depends on your printer being in your local network aka you see it in mDNS comm) or install the printer manually if the temp queue does not work well for you,
  3. a compromise will be found in cups-browsed to make it work without required change in GTK.

I've tried disabling ImplicitClasses in cupsd.conf, but it doesn't seem to help.

There is no such directive. If you want to stop using implicitclass, stop and disable cups-browsed service, or change 'BrowseRemoteProtocols' directive in /etc/cups/cups-browsed.conf to ignore the way how your printers are discovered - 'dnssd' is for mDNS discovery, 'cups' is for legacy CUPS broadcast, or remove/comment out any active 'BrowsePoll' line there.

sjmks commented 1 year ago

Thank you, zdohnal. I hope a reasonable solution will be found / developed in the near future.

Zeki-Zhang commented 11 months ago

I can confirm that setting BrowseRemoteProtocols option in /etc/cups/cups-browsed.conf to dnssd resolves this issue. Many thanks to @zdohnal for the advice!

My application is Document Viewer 43.1, desktop environment is Gnome 43.6