Bug 488097 - Search button of "Set up a Printer Connection" wizard misbehaves
Summary: Search button of "Set up a Printer Connection" wizard misbehaves
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_printer_manager (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2024-06-06 07:57 UTC by Massimiliano L
Modified: 2024-06-13 11:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.2
Sentry Crash Report:


Attachments
Systemsettings crash seen from journalctl (315.28 KB, text/plain)
2024-06-11 13:11 UTC, Massimiliano L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Massimiliano L 2024-06-06 07:57:49 UTC
SUMMARY
When using the "Add Printer" wizard from the system settings "Printers", the user is prompted to insert a printer's address. Near the "Address" field, there is a search button. Pressing such button seems not to produce any action in most cases.

STEPS TO REPRODUCE
1. Open system settings -> Printer
2. Click on Add Printer
3. Wait for the "Unable to automatically discover any printing devices"
3. Insert a printer address (or not) and press the search button.

OBSERVED RESULT
Nothing happens.

But if the address is set to "ipp://" or some other "prefix://" the search returns the existing configured printers, even if they don't appear to match the search criterion.

EXPECTED RESULT
Pressing the search button returns some kind of answer if nothing is found. Likewise, it should not return printers that do not match the search button.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 40 
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1

ADDITIONAL INFORMATION
- oddly, the "Add Printer" feature opens a pop-up window, while the "Add Group" and "Configure Print Server" features just "slide" the current system settings panel to the wizard;
- the wizard crashes very frequently, I will issue another bug if I can get useful crash reports.
Comment 1 Mike 2024-06-06 11:43:04 UTC
When you select Add Printer, are you prompted to authenticate?  Also, do you have the package system-config-printer installed?

Can you post the output from the command: `lpinfo -v`  (You may have to elevate privileges)

Note: The search button on "Manual Config" asks CUPS for printers at the host address.  If you know the printer address, you just type it in and choose "Continue".  If the address is just a scheme, CUPS returns local printers by default, which we should probably ignore as it is bit confusing.  

As far as the crashing, this is something unusual.  You can turn on debugging for the  printer manager in KDebugSettings.  Search "print" and enable Full Debug for kcm and libkcups.  You can than watch the log in a terminal with `journalctl --user -f` to help narrow down what is crashing.
Comment 2 Massimiliano L 2024-06-06 12:13:07 UTC
Thank you for the quick feedback!

(In reply to Mike from comment #1)
> When you select Add Printer, are you prompted to authenticate?

No, I am not prompted for authentication.

> Also, do you
> have the package system-config-printer installed?

I did not, now I have. But it seems to only provide an additional GUI for the same CUPS backend?

> Can you post the output from the command: `lpinfo -v`  (You may have to
> elevate privileges)

I get the following list:
-----------------
file cups-brf:/
network beh
network ipp
network https
network ipps
network http
direct hp
network socket
network lpd
network smb
direct hpfax
-----------------

With or without sudo (only the order is different).

> Note: The search button on "Manual Config" asks CUPS for printers at the
> host address.  If you know the printer address, you just type it in and
> choose "Continue".  If the address is just a scheme, CUPS returns local
> printers by default, which we should probably ignore as it is bit confusing.

OK, now I better understand how this works. I think part of the confusion arises from the fact that the "address" for CUPS can either be an individual networked printer o a CUPS host. The scroll menu with the search result appears only if something is returned, giving the impression that otherwise the "search button" is doing nothing. I think right now I can only add printers through another CUPS server and not directly as network printers, though.

Note: I find a bit confusing to have "select printer" and "continue with address" above the address field / printer list, instead of below.
 
> As far as the crashing, this is something unusual.  You can turn on
> debugging for the  printer manager in KDebugSettings.  Search "print" and
> enable Full Debug for kcm and libkcups.  You can than watch the log in a
> terminal with `journalctl --user -f` to help narrow down what is crashing.

I will as soon as I have the time to look again into this! In the meantime (now that I figured out how this window is supposed to work) I would classify this as UI/UX improvement rather than a bug.
Comment 3 Mike 2024-06-06 13:13:56 UTC
FYI, there are a few UI/UX changes coming in 6.1 regarding the buttons you mention, but yeah, it is not totally clear about the address, so we'll add some help text and a message regarding searching results, etc. to help with the UX.

Regarding system-config-printer, yes it provides an alternative GUI, but printer manager only uses the driver services convenience features (Dbus), which allow for grouping physical devices and recommending "best" drivers when configuring a printer.

What is strange, however, is that you are not forced to authenticate when you choose "Add Printer".  Are you running as root or some other elevated user?  This could also explain crashes in System Settings.
Comment 4 Massimiliano L 2024-06-06 19:10:10 UTC
(In reply to Mike from comment #3)
> What is strange, however, is that you are not forced to authenticate when
> you choose "Add Printer".  Are you running as root or some other elevated
> user?  This could also explain crashes in System Settings.

No, it's a pretty standard Fedora 40 installation. I observe the same behaviour on my other machine, same OS. I wonder if there is some magic (polkit?) going on behind the curtains.
Comment 5 Bug Janitor Service 2024-06-06 19:32:03 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/print-manager/-/merge_requests/180
Comment 6 Massimiliano L 2024-06-11 13:11:48 UTC
Created attachment 170369 [details]
Systemsettings crash seen from journalctl

Thank you for the help! Here is a log of the crash, actually two in a sequence (triggered by the same sequence of operations).
Comment 7 Mike 2024-06-11 19:45:16 UTC
Git commit 90f3daa4fb814bbc9222b6b68d6ee3e896da94ae by Mike Noe.
Committed on 11/06/2024 at 19:42.
Pushed by noee into branch 'master'.

kcm/[core,qml]: Cleanup Manual Config/Remote printer search

qml: Add contextual help for the manual config options.  For printer host
search, don't populate list with "local" printers.  Also, handle CUPS
results and errors for remote printer search.

core: Don't emit remotePrintersLoaded if there is a CUPS error
FIXED-IN: 6.2

M  +1    -2    src/kcm/printermanager.cpp
M  +20   -13   src/kcm/ui/components/ManualUri.qml

https://invent.kde.org/plasma/print-manager/-/commit/90f3daa4fb814bbc9222b6b68d6ee3e896da94ae
Comment 8 Massimiliano L 2024-06-12 07:19:33 UTC
(In reply to Mike from comment #7)
> Git commit 90f3daa4fb814bbc9222b6b68d6ee3e896da94ae by Mike Noe.
> Committed on 11/06/2024 at 19:42.
> Pushed by noee into branch 'master'.
> 
> kcm/[core,qml]: Cleanup Manual Config/Remote printer search
> 
> qml: Add contextual help for the manual config options.  For printer host
> search, don't populate list with "local" printers.  Also, handle CUPS
> results and errors for remote printer search.
> 
> core: Don't emit remotePrintersLoaded if there is a CUPS error
> FIXED-IN: 6.2
> 
> M  +1    -2    src/kcm/printermanager.cpp
> M  +20   -13   src/kcm/ui/components/ManualUri.qml
> 
> https://invent.kde.org/plasma/print-manager/-/commit/
> 90f3daa4fb814bbc9222b6b68d6ee3e896da94ae

Thank you for following-up so quickly, this kind of UI improvements is very much appreciated!

Should I open a new bug for the crashing issues or was this addressed in the further commits?
Comment 9 Mike 2024-06-12 13:34:57 UTC
Yeah, please do.  I see in the log where the crash happened and that code has changed, though I'm not really sure if that's the cause.  Either way, I am unable to reproduce the crash on 6.0.5, 6.1 or master.  Fedora 40 KDE VM is hosed too so I'll have a look in a few days.

Meantime, any way you can test with 6.1 with Fedora?
Comment 10 Massimiliano L 2024-06-13 11:58:52 UTC
(In reply to Mike from comment #9)
> Yeah, please do.  I see in the log where the crash happened and that code
> has changed, though I'm not really sure if that's the cause.  Either way, I
> am unable to reproduce the crash on 6.0.5, 6.1 or master.  Fedora 40 KDE VM
> is hosed too so I'll have a look in a few days.
> 
> Meantime, any way you can test with 6.1 with Fedora?

I need to wait for Fedora to ship 6.1, it should not take long. As soon as that happens, I will try to reproduce the bug and follow up with a new report. Thank you again!