cupsGetDests2 shows deleted printers

ToddAndMargo

New Member
Joined
Nov 17, 2020
Messages
15
Reaction score
11
Credits
161
Dear Linux.org,

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 cleaned 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;
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
 


I don’t think the programs are doing anything wrong.

what I’d recommend trying is:
Bash:
lpstat -p oldprintername -l
If it lists the printer, then it’s still set up in cups, so remove it like this:
Bash:
lpadmin -x oldprintername
And then run the lpstat command again and you should get an error because the printer has been removed.


But if the first lpstat command gives an error, then the printer IS already removed, so it’s details must be getting cached somewhere else that is used by cupsGetDests2. And in that case, I’m not sure what to suggest other than perhaps filing a bug report with the cups developers on their GitHub bug-tracker.

 
Last edited:
$ 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

I strongly suspect this is an issue with cupsGetDests2. Do you know how cupsGetDests2 reads its information?

I have attached my printcap and printers.conf files
 

Attachments

  • printers.conf.txt
    1.7 KB · Views: 365
And what happens if you try the lpadmin -x oldprintername command with the old printers? where oldprintername is the name of the old printer.

Regarding, cupsGetDests2: I don’t know offhand. I’ll take a look at some point and will get back to you. It sounds like some kind of bug with cups. Perhaps there’s a cache somewhere which isn’t being updated properly when a printer is removed.....
 
Jas, just with the lpadmin command - don't know if I am barking up the wrong tree and you know me well enough to tell me so :)

Todd's output from

Code:
groups

might be revealing.

Why I say is that I have looked at 3 of my stable from different families, and I get these from Debian, Manjaro and Fedora 33

Code:
# Debian 10 ‘Buster’ KDE

chris@Buster-KDE-HDD:~$ groups
chris cdrom floppy sudo audio dip video plugdev netdev bluetooth lpadmin scanner

# Manjaro GNOME

[chris@MJRO-GNOME-HDD ~]$ groups
sys network power lp wheel chris

# Fedora 33 Workstation

[chris@localhost ~]$ groups
chris wheel

I have had no need to tweak these, so these are the default settings for those three, and Todd's Fedora may have no access to lpadmin, yet.

HTH

Wizard
 
Hi All,

Now I am feeling a bit guilty. You guys bent over backwards to help me and it turned out that the issues is a "short between the headsets". :'(

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 on to a printer that is shared on the network. Cups was also using my host name. And 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 <-- local printer name
Cups_PDF_rn6 <-- shared name

Virtual_PDF_Printer <-- local printer name
Virtual_PDF_Printer_rn6 <--shared name


So as a mentor explained to me during my young engineering days, whilst complaining over some injustice: "Into everyone's life a humility must fall."

Now I will go wipe some eggs off my face.

:'(

-T
 
No worries! Nothing to feel guilty about.
I didn’t know that either, so I guess everybody learnt something new in this thread!!
 
Now I will go wipe some eggs off my face.

Personally, I love the taste of eggs, so a bit on my face does not worry me.

Jas occasionally is the egg distributor, but I learn from it.

Enjoy your Linux, Todd, and consider swinging over to Member Introductions and telling us a little of the ToddAndMargo story, and meet some more of the Gang.

Cheers

Chris Turner
wizardfromoz
 

Staff online

Members online


Top