FS#57304 - [cups] Patch to disable print dialog autodiscovery of avahi browse dnssd printers

Attached to Project: Arch Linux
Opened by Chris Severance (severach) - Wednesday, 31 January 2018, 06:17 GMT
Last edited by Andreas Radke (AndyRTR) - Wednesday, 21 March 2018, 14:06 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Andreas Radke (AndyRTR)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Print dialogs are set to search the network with avahi to autodetect IPP printers. Cups shares printers with IPP so these are found too. This isn't a problem at home with only two printers. At work with 50 printers the dialogs become a minefield and are hard to use. Many IPP printer implementations are broken so attempting to use a non local IPP printer rejecting jobs results in crashes. I've turned IPP off in all my printers but there are still 3 with defective IPP implementations that can't be turned off, the one of which I can find is an HP LaserJet M451nw. All you see in the print dialog is "print" "printer" and "print0" and clicking them eventually locks Firefox.

With many brands disabling IPP also disables AirPrint via Bonjour. Disabling Bonjour on the M451nw does disable IPP but it no longer detects with [Add Printer].

Before I disabled IPP on every printer that allowed it I had the infamous Brother duerqxesz5090, probably more than one but IPP is so badly implemented that I can't know how many there are or where they're from.

"Who is this? What's your operating number?" https://www.youtube.com/watch?v=L8AZvx_wsg4

Solution: patch out avahi printer autodiscovery. I want avahi for [Add Printer] but not in the print dialogs. Everyone printing to every printer is not how it works.

Some automatic printer problems are solved by disabling cups-browsed.service. This isn't the problem being solved here.

Disabling avahi stops the print dialogs from scanning for printers but then [Add Printer] can't see any network printers.

Fixing libcups cups/dest.c::cupsGetDests() fixes all non gtk apps like QT and Chrome which is only half the battle. gtk-print-backends does not use libcups and does it's own thing. I have a patch for gtk3 to catch GTK apps like Firefox, Evince, and LibreOffice. Patching either cups or gtk is no good. Both patches must be applied or neither so the dialog behavior stays consistent.

https://lists.debian.org/debian-user/2017/09/msg00980.html
https://ubuntuforums.org/showthread.php?t=2330752
https://askubuntu.com/questions/477082/hide-remove-network-printers-from-printing-dialog
https://askubuntu.com/questions/676863/how-do-i-get-rid-of-a-ghost-printer-in-gnome
https://askubuntu.com/questions/538722/how-do-i-remove-a-phantom-printer-driver
This task depends upon

Closed by  Andreas Radke (AndyRTR)
Wednesday, 21 March 2018, 14:06 GMT
Reason for closing:  Upstream
Additional comments about closing:  nothing we should deal with.
Comment by Andreas Radke (AndyRTR) - Wednesday, 31 January 2018, 08:47 GMT
Why don't you modidy cups-filters.conf option # CreateIPPPrinterQueues LocalOnly ? Isn't that what you are looking for?
Comment by Chris Severance (severach) - Wednesday, 31 January 2018, 20:39 GMT
Maybe you're referring to this problem, which includes posts on two distinct problems.

https://askubuntu.com/questions/345083/how-do-i-disable-automatic-remote-printer-installation/

There is no cups-filters.conf. CreateIPPPrinterQueues is found in cups-browsed.conf. That service isn't running and no queues are being created. Some queues are being advertised by [x] Share printers connected to this system, not cups-browsed. The printers are showing from an avahi scan, either through cups, or directly with gtk-print-backends.

The goal of this misfeature is to print like AirPrint. Buy printer, plug in, ^P print, there it is! You print to it without finding the driver and creating a queue. That would be fine if I only had two printers, the IPP interface was flawless, all printers always showed up, local queues sort first, always in the same order, and the myriad of options and packages required to print through dnssd were installed by default. WSD auto discovery is just as bad as IPP but from what I read is at least smart enough to go dormant when it sees 30+ printers. IPP browsing is not. The local printers I want are randomly sorted in the discovered printers.

Note that gtk-print-backends crawls the avahi network for printers independent of cups. No cups setting will have any effect on the rampaging horde of printers in a GTK print dialog which is why it requires a separate patch.

After posting I discovered that this misfeature is worse than I thought. When going through all the printers to disable IPP I noticed a few didn't respond. Then I looked at my monitor report and saw 3 printers off the network. Clicking on them not only crashed Firefox, the printers crashed off the network. I had to repower the printers to get them working again. One was crashed so bad I had to pull the plug. Just what I need, random Linux users crashing printers by clicking on the wrong one. What could go wrong?

The gtk print dialog in FireFox scans for ipp and ipps printers which looks like this when I have as many IPP printers disabled as possible. Bonjour and Airprint printers do not show in this list.

HPM401 P2
print Rejecting jobs
printer Rejecting jobs
prt0 Rejecting jobs

The Chrome print dialog uses libcups which scans with avahi. It shows ipp, ipps, Airprint, and some Bonjour printers. Fortunately I set the Bonjour names to something meaningful. 10 P2035n printers with hex codes after them would be on beyond useless.

Lexmark_MS310dn__PA_Billing_99_
Brother_MFC_J870DW__Andreas_119_
Brother_MFC_J875DW__AllanBrokeIt_111_
Brother_MFC_J875DW__Shipping_112_
HP_LaserJet_400_color_M451nw__Storage_92_
HP_LaserJet_P2035n_archserver
HPM401
Lexmark_MS510dn__P8_Boss_114_
Lexmark_MS810n__OLY5800_42_

The Lexmark have IPP disabled and the Brother have AirPrint disabled. They still show up.

There are 9 HP_LaserJet_P2035n_archserver shared by cups but I only see one because they all have the same name. Only the local queue prints. The others require some option I haven't installed, or maybe they require IPP enabled. Noone knows because IPP is such a black box.

...

I must look through 50 printers to find the one I want. Many of these printers are special purpose and should never be seen by anyone on a desktop.

Here's another one.

https://superuser.com/questions/874650/printer-flapping-with-cups
Comment by Andreas Radke (AndyRTR) - Wednesday, 31 January 2018, 21:02 GMT
What's your configuration? Do you only use the unsupported and deprecated /etc/cups/client.conf to discover printers or you should run cupsd+cups-browsed together and configure cups-browsed.conf properly.

If that doesn't allow to reduce the printers shown I guess you should bring it upstream to either cups-filters or cups project. Such changes shouldn't be done only downstream. See Arch policy.
Comment by Chris Severance (severach) - Wednesday, 31 January 2018, 21:37 GMT
I don't see a /etc/cups/client.conf. I use http://127.0.0.1:631/ Administration Add Printer. Control Panel Hardware Printers would also work but I don't use it.

Automatically adding queues for every found IPP printer and remote cups queue would be an even bigger disaster. At least the autodetected printers go away when the printers do. I'll be looking into cups-browsed to see if it can do the exact feature I need: Update or remove local queues that already exist from a remote server. Adding every queue on the server would make it useless. I see it can add queues by pattern which is slightly less useless. The big question is, will it update them? No update, no deal!

There are certainly some bugs here but the big problem is throwing up every printer you can find just because you can. That's not how to run a network.
Comment by Chris Severance (severach) - Tuesday, 06 February 2018, 18:42 GMT Comment by Andreas Radke (AndyRTR) - Tuesday, 06 February 2018, 19:33 GMT
It would be nice to bring this also to Cups and Cups-Filters upstream. I suggest a post to the cupd-devel mailing list to get some attention.

Loading...