Bug 489581

Summary: Search & Replace silently fails on non-existent folders
Product: [Applications] kate Reporter: Andrew M <quantumphazor>
Component: searchAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: christoph
Priority: NOR    
Version First Reported In: 24.05.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Andrew M 2024-07-02 03:58:34 UTC
SUMMARY
Running a find in files search fails silent when using a non-existent folder.

STEPS TO REPRODUCE
1. Open the Search & Replace plug-in's tab (Ctrl+Shift+F)
2. Set the search scope to "In Folder"
3. Set Folder to "/doesntexist/"
4. Search for "foo"

OBSERVED RESULT
Search shows an empty result pane immediately.

EXPECTED RESULT
Some kind of error about the folder not existing.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 6.9.7-arch1-1
KDE Plasma Version: 6.1.1
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2
Comment 1 Christoph Cullmann 2024-07-05 18:20:40 UTC
void FolderFilesList::checkNextItem(DirectoryWithResults &handleOnFolder) const
{
    /**
     * IMPORTANT: this member function is called by MULTIPLE THREADS
     * => it is const, it shall only modify handleOnFolder
     */

    if (m_cancelSearch) {
        return;
    }

    QDir currentDir(handleOnFolder.directory);
    if (!currentDir.isReadable()) {
        // qDebug() << currentDir.absolutePath() << "Not readable";
        return;
    }

atm we just skip that, perhaps we should add some kind of dummy entry for such cases to the results
Comment 2 Bug Janitor Service 2025-02-01 19:18:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1710
Comment 3 Christoph Cullmann 2025-02-03 09:52:43 UTC
Git commit 00f512e62184039cec5e2b75dc0ac7ccb2fa0003 by Christoph Cullmann.
Committed on 03/02/2025 at 09:24.
Pushed by cullmann into branch 'master'.

abort search with error if the base dir is not there

M  +14   -0    addons/search/SearchPlugin.cpp

https://invent.kde.org/utilities/kate/-/commit/00f512e62184039cec5e2b75dc0ac7ccb2fa0003