Bug 420911

Summary: Authentication dialog to access a Samba share always re-appears together a pointiless "Examining" notification after canceling
Product: [Applications] dolphin Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kfm-devel, linus.kardell, nate, peterdabrowski, sitter
Priority: HI Keywords: regression
Version: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 20.04.1
Sentry Crash Report:
Attachments: screen recording

Description Patrick Silva 2020-05-02 16:53:46 UTC
Created attachment 128097 [details]
screen recording

SUMMARY
I can't reproduce this extremely annoying behavior consistently, but it generally occurs after the steps below.

STEPS TO REPRODUCE
1. try to access a password-protected samba share with Dolphin
2. cancel the authentication dialog when it appears
3. try to access the same samba share again
4. when the authentication dialog appears, wait ~10 seconds and cancel it

OBSERVED RESULT
authentication dialog re-appears together a pointless "Examining" notification.
If I cancel it again, it always re-appears together another "Examining" notificaiton. The only ways to stop it definitely are closing or killing Dolphin. Watch the attached screen recording please.

EXPECTED RESULT
authentication dialog should never re-appear after cenceling.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.18.80
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.2
Comment 1 Harald Sitter 2020-05-04 07:59:54 UTC
Moving down the stack. At a glance this is a bug in dolphin.

A fairly reliable way to reproduce this is:

- dolphin --new-window smb://somehost
- drill into a share with auth
- minimize window
- wait a second or two
- alt-tab into window again
- auth loop starts

The reason it keeps asking for auth is because dolphin keeps running a stat on the same url expecting a different outcome. Trace below.

The stat triggers the auth dialog, that causes dolphin to lose window focus, the smb slave comes back with an error (ERR_ACCESS_DENIED), dolphin gets focus again, the window gets an activation event again (cause of the regained focus) and the same dance happens again.

There's a number of problems with this IMHO.

Firstly the obvious bug at hand.

Secondly, dolphin shouldn't look up the find tool on window activation, if anything it should happen if and when the url of the "container" changes. Even if the code wasn't misbehaving, the way it is currently written needlessly stats the same url even when the url hasn't changed.

Lastly, KIO::mostLocalUrl shouldn't run any stat on jobs that aren't local they'll not have a mostLocalUrl because they aren't local. I've opened bug #420985 for this.

#0  KIO::StatJob::StatJob (this=0x555556734db0, dd=...) at ./src/core/statjob.cpp:68
#1  0x00007ffff5d158ea in KIO::StatJobPrivate::newJob (flags=..., packedArgs=..., command=69, url=...) at ./src/core/statjob.cpp:58
#2  KIO::statDetails (url=..., side=side@entry=KIO::StatJob::SourceSide, details=..., details@entry=..., flags=...) at ./src/core/statjob.cpp:235
#3  0x00007ffff5d159d7 in KIO::mostLocalUrl (url=..., flags=..., flags@entry=...) at ./src/core/statjob.cpp:212
#4  0x00007ffff7b2ede9 in DolphinMainWindow::activeContainerLocalPath (this=this@entry=0x555555853020) at ./src/dolphinmainwindow.cpp:945
#5  0x00007ffff7b360f5 in DolphinMainWindow::preferredSearchTool (this=this@entry=0x555555853020) at ./src/dolphinmainwindow.cpp:959
#6  0x00007ffff7b36474 in DolphinMainWindow::updateOpenPreferredSearchToolAction (this=0x555555853020) at ./src/dolphinmainwindow.cpp:1001
#7  0x00007ffff7b369fa in DolphinMainWindow::event (this=0x555555853020, event=0x7fffffffd360) at ./src/dolphinmainwindow.cpp:2301
#8  0x00007ffff270b9ac in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff2712bb0 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007ffff1350128 in QCoreApplication::notifyInternal2 (receiver=0x555555853020, event=0x7fffffffd360) at kernel/qcoreapplication.cpp:1075
#11 0x00007ffff2710a83 in QApplication::setActiveWindow(QWidget*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ffff2710c83 in QApplicationPrivate::notifyActiveWindowChange(QWindow*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007ffff1e16465 in QGuiApplicationPrivate::processActivatedEvent (e=<optimized out>) at kernel/qguiapplication.cpp:2436
#14 0x00007ffff1e1aaed in QGuiApplicationPrivate::processWindowSystemEvent (e=e@entry=0x555556373cb0) at kernel/qguiapplication.cpp:1956
#15 0x00007ffff1df31cb in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1170
#16 0x00007fffe20fcf9a in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#17 0x00007fffe9282417 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007fffe9282650 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007fffe92826dc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007ffff13af42c in QEventDispatcherGlib::processEvents (this=0x555555800270, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#21 0x00007ffff134e9aa in QEventLoop::exec (this=this@entry=0x7fffffffd700, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225
#22 0x00007ffff1358120 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1383
#23 0x00007ffff7b2a7c5 in kdemain (argc=<optimized out>, argv=<optimized out>) at ./src/main.cpp:189
#24 0x00007ffff7713b97 in __libc_start_main (main=0x555555554720 <main>, argc=3, argv=0x7fffffffd968, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7fffffffd958) at ../csu/libc-start.c:310
#25 0x000055555555475a in _start ()
Comment 2 Nate Graham 2020-05-04 13:35:05 UTC
Apparently caused by https://phabricator.kde.org/D22594.

Piotr, could you take a look?
Comment 3 Kai Uwe Broulik 2020-05-05 10:05:44 UTC
Git commit 9f268f5f76a4a4f0c91abcc213e159c8bde4869c by Kai Uwe Broulik.
Committed on 05/05/2020 at 10:05.
Pushed by broulik into branch 'release/20.04'.

Don't use local URL for KMoreTool

This method is called a billion times and spawns a blocking(!) StatJob.
KFind can search local URLs, too, so I don't see why this is necessary.
Either way, I'd rather have a non-KDE search tool broken than the app.
Ideally, I'd like this entire thing redone to use an async StatJob, if any.
Fwiw the KMoreTools in the free space bar doesn't use a local URL either.
FIXED-IN: 20.04.1

Differential Revision: https://phabricator.kde.org/D29442

M  +1    -1    src/dolphinmainwindow.cpp

https://commits.kde.org/dolphin/9f268f5f76a4a4f0c91abcc213e159c8bde4869c
Comment 4 Kai Uwe Broulik 2020-05-06 08:52:39 UTC
Git commit 801fdf4c59691f2787c052b9f9392635c76a7627 by Kai Uwe Broulik.
Committed on 06/05/2020 at 08:52.
Pushed by broulik into branch 'release/20.04'.

Don't update preferred search action on window activation

I don't see why this is necessary and causes a blocking(!) StatJob every single time the window is focussed,
worse, ends up in an infinite loop when the window loses focus on an auth prompt.

Differential Revision: https://phabricator.kde.org/D29441

M  +0    -2    src/dolphinmainwindow.cpp

https://commits.kde.org/dolphin/801fdf4c59691f2787c052b9f9392635c76a7627
Comment 5 Nate Graham 2020-05-24 14:26:59 UTC
Git commit 29e6cf01df755724a629203964c9b61cd2f383c4 by Nate Graham, on behalf of Piotr Henryk Dabrowski.
Committed on 24/05/2020 at 14:26.
Pushed by ngraham into branch 'release/20.04'.

use KSycoca for updating OpenPreferredSearchTool action

Summary:
Remove all random updates of OpenPreferredSearchTool action, and
use KSycoca for updating it as discussed in https://phabricator.kde.org/D22594#663847

Enhancement for D29441 for bug #420911 caused by D22594.
The bug was fixed by D29442.

Test Plan:
```
$ cd ${KDE_INSTALL_DIR}/usr/share/applications

$ sudo mv org.kde.kfind.desktop org.kde.kfind.desktop_
$ kbuildsycoca5

$ sudo mv org.kde.kfind.desktop_ org.kde.kfind.desktop
$ kbuildsycoca5
```

Reviewers: broulik, elvisangelaccio, ngraham, #dolphin

Reviewed By: elvisangelaccio, #dolphin

Subscribers: anthonyfieroni, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D29568

M  +4    -25   src/dolphinmainwindow.cpp
M  +0    -3    src/dolphinmainwindow.h

https://invent.kde.org/system/dolphin/commit/29e6cf01df755724a629203964c9b61cd2f383c4
Comment 6 Ahmad Samir 2020-06-01 10:27:37 UTC
*** Bug 422094 has been marked as a duplicate of this bug. ***