Bug 1903801 - cupsGetDests2 shows permanent and temporary queues [expected]
Summary: cupsGetDests2 shows permanent and temporary queues [expected]
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: cups
Version: 33
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Zdenek Dohnal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-12-02 19:49 UTC by Todd
Modified: 2020-12-07 02:55 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-12-03 08:23:12 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
printer.conf and printcap (1.70 KB, text/plain)
2020-12-05 03:03 UTC, Todd
no flags Details

Description Todd 2020-12-02 19:49:47 UTC
Dear Fedora Cups Maintainer

Fedora 33

# rpm -qa cups\*
cups-pk-helper-0.2.6-10.fc33.x86_64
cups-pdf-3.0.1-10.fc33.x86_64
cups-libs-2.3.3-18.fc33.x86_64
cups-client-2.3.3-18.fc33.x86_64
cups-ipptool-2.3.3-18.fc33.x86_64
cups-filesystem-2.3.3-18.fc33.noarch
cups-2.3.3-18.fc33.x86_64
cups-libs-2.3.3-18.fc33.i686
cups-filters-libs-1.28.5-3.fc33.x86_64
cups-filters-1.28.5-3.fc33.x86_64

I clean up a bunch of my unused printers.

Problem: printers with the same long name, except for 
the end still show in certain programs.

$ lpstat -a
B4350 accepting requests since Thu 29 Oct 2020 01:36:30 PM PDT
Cups-PDF accepting requests since Tue 30 Apr 2019 04:05:39 PM PDT
Virtual_PDF_Printer accepting requests since Tue 29 Sep 2020 03:13:17 AM PDT

Which is the way it is suppose to be. And match http://127.0.0.1:621 and Printer Admin


But programs using reading printers using cupsGetDests2, 
still get the old deleted printers:

The C text: https://bugs.documentfoundation.org/attachment.cgi?id=167701

The Binary: https://bugs.documentfoundation.org/attachment.cgi?id=167702

#include <iostream>
#include <cups/cups.h>

int main() {
cups_dest_t* dests;
int nCount = cupsGetDests2(CUPS_HTTP_DEFAULT, &dests);

for (int i = 0; i < nCount; i++) {
cups_dest_t dest = dests[i];
std::cout << dest.name << std::endl;
} 
}

$ list-printers
B4350
Cups-PDF
Cups_PDF_rn6             <-- deleted
Oki_B4350_on_dev_lp0_rn6 <-- deleted
Virtual_PDF_Printer
Virtual_PDF_Printer_rn6  <-- deleted


Programs without the problem (a sampling):

Brave Browser, Firefox, Vivaldi, Water Fox, 
Leafpad, Simple scan, Gimp, Inkscape, Thunderbird,
Geany, Shotwell, PDF Studio 2019

Programs with the problem (also a sampling):

Wine, Libre Office, Free Office, Master PDF Editor

Any ideas? Is cupsGetDests2 not the proper way of doing this?

-T

Comment 1 Zdenek Dohnal 2020-12-03 08:23:12 UTC
Hi Todd,

thank you for reporting the issue!

It actually doesn't show a deleted print queues, but a temporary ones+permanent ones - in other words, it shows all queues available to you.
It is done like this - it collects a print queues which are stored within cupsd (in 'Printers' global struct) and then it does avahi call for devices on the local network. The returned data is processed and added to cupsGetDests2() result.

`lpstat -a` only shows a permanent queues which are accepting jobs, not temporary ones, because they are created once you enter a print dialog, so there is no need to show them in `lpstat -a` output - if they accept jobs, they will be shown in print dialog.

What is 'rn6' on your network?

Depending on the answer, it would answer a lot. Because it looks like a 'rn6' server, which shares its queues on the local network and your client, which is on the same network, sees them as temporary queues.

However, you manually or via cups-browsed installed a local queues on your client pointing to those queues on the server, which makes them permanent.

So showing them twice is the expected behavior when you already have a permanent queue. It is meant to give a notice you actually don't need those permanent queues unless you want a different printing options than a manufacturer supplies and you don't want to change them every time in print dialog before printing, or if you want to share your local queues on client further through the network.

Ad programs with/without problem:
I'm not sure about most of them, but I know about Firefox uses GTK, which does avahi calls by itself, so you can get into state where you don't see the queues you removed.

Then libreoffice asks cupsd directly, so you will always see queues you 'removed'.


===============================

TO SUM IT UP:

This is not a bug. If you don't want to see those print queues twice, stop+disable cups-browsed and remove the permanent queues which are supported by temporary queues.

However, you can tackle this bug https://bugzilla.redhat.com/show_bug.cgi?id=1784449 in a specific network setups. If you hit the bug, please add a comment to the bz#1784449.

Comment 2 Zdenek Dohnal 2020-12-03 08:31:35 UTC
There is a known mitigation for that gtk3 bug - print from libreoffice or any non-gtk based application.

I'm not sure how many apps are based on GTK, but from those I know - Firefox, Thunderbird, evince, gvim.

Comment 3 Todd 2020-12-05 03:01:43 UTC
Not to ask too stupid a question, but if cupsGetDests2 is not the proper way to get permanent queues, what is the proper way to ask CUPS the permanent queues?

Comment 4 Todd 2020-12-05 03:03:45 UTC
Created attachment 1736577 [details]
printer.conf and printcap

The extra deleted printers are not showing in printcap or printers.conf.

$ lpstat -p Cups_PDF_rn6 -l
$ lpstat -p Oki_B4350_on_dev_lp0_rn6 -l
$ lpstat -p Virtual_PDF_Printer_rn6 -l
All three returned nothing.

And a good printer returns:
$ lpstat -p B4350 -l
printer B4350 is idle. enabled since Fri 04 Dec 2020 03:45:27 PM PST

Where are these temporary files?

Comment 5 Todd 2020-12-07 02:55:19 UTC
Follow up:

These are not extras that did not delete when I deleted the originals.  What transpired was the I was experimenting with several way to access a parallel port card and had created several printers using "_rn6" at the end of their names.  "_rn6" is the host name of the computer.

What I "thought" were un-deleted printers was actually the name cups tacks a printer that is shared on the network.  An d it took me several day to realize I was looking at a coincidence.  "cupsGetDests2" in its "ultimate  wisdom" list both the local name and the shared name:

Cups-PDF
Cups_PDF_rn6 <-- Shared name
 
Virtual_PDF_Printer
Virtual_PDF_Printer_rn6  <--Shared name

Now I will go wipe some eggs off my face.  Thank you for your patience.


Note You need to log in before you can comment on or make changes to this bug.