Bug 138200 - PRINT DIALOG: Please remove deleted printers
Summary: PRINT DIALOG: Please remove deleted printers
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.0.3.1 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Print-Dialog
  Show dependency treegraph
 
Reported: 2020-11-13 19:54 UTC by Todd
Modified: 2020-12-07 06:45 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Deleted printer still showing. Red arrow pointing to them (52.05 KB, image/png)
2020-11-13 19:54 UTC, Todd
Details
Sample program to list printers (270 bytes, text/x-c++src)
2020-12-01 05:28 UTC, Michael Weghorn
Details
Sample program to list printers (binary) (16.85 KB, application/x-sharedlib)
2020-12-01 05:29 UTC, Michael Weghorn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Todd 2020-11-13 19:54:30 UTC
Created attachment 167286 [details]
Deleted printer still showing.  Red arrow pointing to them

Fedora 33
LibreOffice-7.0.3-Linux_x86-64_rpm.tar.gz

I cleaned out a bunch of unused printers.  Libreoffice still see them

$ 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

Same as show in Printer Admin and CUPS.

All the deleted printer still show in LibreOffice Writer and Calc

looks like https://ibb.co/3R4BM5F  (also attached here)

Red arrows on the deleted printers

:'(

Please fix.
Comment 1 Dieter 2020-11-29 07:03:58 UTC
I can't confirm it with

Version: 7.0.3.1 (x64)
Build ID: d7547858d014d4cf69878db179d326fc3483e082
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL
Comment 2 Todd 2020-11-29 08:11:38 UTC
(In reply to Dieter from comment #1)
> I can't confirm it with
> 
> Version: 7.0.3.1 (x64)
> Build ID: d7547858d014d4cf69878db179d326fc3483e082
> CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL:
> win
> Locale: de-DE (de_DE); UI: en-GB
> Calc: CL

Try it under Fedora 33, not Windows 10.

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
Comment 3 Michael Weghorn 2020-11-30 07:10:51 UTC
Do the printers still show after closing LibreOffice and starting it again (or even better, a reboot)?

(On Linux, LibreOffice retrieves printer once on startup, so changes after that only show up after restarting it.)
Comment 4 Todd 2020-11-30 08:46:38 UTC
(In reply to Michael Weghorn from comment #3)
> Do the printers still show after closing LibreOffice and starting it again
> (or even better, a reboot)?

It still exhibits the issues after about 15 reboot and 50 restarts of LibreOffice,

> (On Linux, LibreOffice retrieves printer once on startup, so changes after
> that only show up after restarting it.)

I suspect LO has a cache of printers that LO adds to be does not overwrite
Comment 5 Michael Weghorn 2020-11-30 10:31:30 UTC
(In reply to Todd from comment #4)
> > (On Linux, LibreOffice retrieves printer once on startup, so changes after
> > that only show up after restarting it.)
> 
> I suspect LO has a cache of printers that LO adds to be does not overwrite

Not that I know (but I didn't double-check so far), as far as I know, LO just retrieves them from CUPS.

In comment 2, you mention that other printers also still show them.

Interestingly, all of the printers have an '_rn6' suffix. Are those possibly remote printers shared on the network, e.g. from some other host (maybe called 'rn6') and advertised e.g. using DNS-SD/Bonjour?

Do you have cups-browsed installed and running? If so, do the printers still show up after disabling it?
Comment 6 Todd 2020-11-30 23:43:03 UTC
(In reply to Michael Weghorn from comment #5)
> (In reply to Todd from comment #4)
> > > (On Linux, LibreOffice retrieves printer once on startup, so changes after
> > > that only show up after restarting it.)
> > 
> > I suspect LO has a cache of printers that LO adds to be does not overwrite
> 
> Not that I know (but I didn't double-check so far), as far as I know, LO
> just retrieves them from CUPS.
> 
> In comment 2, you mention that other printers also still show them.
> 
> Interestingly, all of the printers have an '_rn6' suffix. Are those possibly
> remote printers shared on the network, e.g. from some other host (maybe
> called 'rn6') and advertised e.g. using DNS-SD/Bonjour?
> 
> Do you have cups-browsed installed and running? If so, do the printers still
> show up after disabling it?

All the printers are local printers

The problem seems to only be associated with long printer names that are only different at the end of the name.

I created a printer called MickyMouse and Writer picked it up and dumped it after I deleted it.

So, I seems that you may need to increase the string (array of characters) you are using to read in the printer names.  But that does not explain why you hold on to a defunct name, unless the comparison between old names and new names is also not being done on enough characters.
Comment 7 Michael Weghorn 2020-12-01 05:28:38 UTC
Created attachment 167701 [details]
Sample program to list printers
Comment 8 Michael Weghorn 2020-12-01 05:29:07 UTC
Created attachment 167702 [details]
Sample program to list printers (binary)
Comment 9 Michael Weghorn 2020-12-01 05:30:54 UTC
(In reply to Todd from comment #6)
> All the printers are local printers
> 
> The problem seems to only be associated with long printer names that are
> only different at the end of the name.
> 
> I created a printer called MickyMouse and Writer picked it up and dumped it
> after I deleted it.
> 
> So, I seems that you may need to increase the string (array of characters)
> you are using to read in the printer names.  But that does not explain why
> you hold on to a defunct name, unless the comparison between old names and
> new names is also not being done on enough characters.

Since other applications show the same issue, and LibreOffice retrieves the printers from CUPS, I'd be surprised if this was actually a LO problem and not something on a lower level.

However, I'll be happy to test this further.
Can you give exact steps how to reproduce the issue? Can you reproduce this by setting up a new local printer with a certain name and then delete it?

At a quick glance, LO uses 'cupsGetDests2' from the CUPS library to retrieve available printers [1].

Can you run the attached sample program and paste the output here. It also uses 'cupsGetDests2' to retrieve and list printers (but might use different parameters from what LO does, so the output may vary).

Also, do you have CPD (Common Printing dialog) libraries installed? (In this case, LibreOffice uses those to retrieve printers instead.)



[1] https://opengrok.libreoffice.org/xref/core/vcl/unx/generic/printer/cupsmgr.cxx?r=6fc2a300#241
Comment 10 Todd 2020-12-02 19:32:07 UTC
$ list-printers
B4350
Cups-PDF
Cups_PDF_rn6
Oki_B4350_on_dev_lp0_rn6
Virtual_PDF_Printer
Virtual_PDF_Printer_rn6


$ 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


Hmmmmm.....

# 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
Comment 11 Todd 2020-12-02 19:53:08 UTC
I opened the following companion bug:

cupsGetDests2 shows deleted printers
https://bugzilla.redhat.com/show_bug.cgi?id=1903801

As most programs read the printers list correctly, I am thinking that  upsGetDests2 may not the proper way read them now a days, or contains a nasty bug

Loved the C code for reading cupsGetDests2. Thank you!
Comment 12 Michael Weghorn 2020-12-03 05:59:26 UTC
Thanks for testing! Closing as NOTOURBUG then, since there's no problem on LibreOffice level here.
Comment 13 Todd 2020-12-03 06:25:24 UTC
Hi Michael,

As most of my programs are not exhibiting this issue, you may not be calling CUPS in the CUPS recommended manner.  I will post back the findings what happens on the CUPS a bug report.  Until then we wait

I files another bug with upstream CUPS:

cupsGetDests2 shows deleted printers
https://github.com/apple/cups/issues/5862

-T
Comment 14 Michael Weghorn 2020-12-03 06:37:16 UTC
OK, let's wait then. I'm setting this bug to NEEDINFO for now.
Comment 15 Todd 2020-12-07 03:41:13 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 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, a bit confusing to show a local printer and its shared network name, but that is the way cupsGetDests2 works, so "not a bug".

Thank you for all your patience with this.
Comment 16 QA Administrators 2020-12-07 04:14:13 UTC Comment hidden (obsolete)
Comment 17 Michael Weghorn 2020-12-07 06:45:24 UTC
Thanks for the update!
(Closing again, since some automation has reopended this...)