Bug 498255

Summary: kiod6 exits prematurely, after first save operation
Product: [Frameworks and Libraries] frameworks-kio Reporter: Dmitry Shachnev <mitya57>
Component: generalAssignee: KIO Bugs <kio-bugs-null>
Status: REPORTED ---    
Severity: normal CC: kdelibs-bugs-null, sitter
Priority: NOR    
Version First Reported In: 6.8.0   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Stack traces from gdb

Description Dmitry Shachnev 2025-01-04 17:47:18 UTC
Created attachment 177110 [details]
Stack traces from gdb

SUMMARY
When you open a file using kioexec in a third-party application, after first save from that application the temporary directory is deleted, and saving the file second time is impossible.

STEPS TO REPRODUCE
1. Connect an Android phone as MTP device. Maybe the same will happen with other protocols, but I have not tested.
2. Create an empty file named test.txt on that device.
3. Open that file in a non-KDE editor from Dophin (I tested with ReText and Geany).
4. Edit the file, click Save.
5. In the "File Changed" dialog, click Upload.
6. In the "File Already Exists" dialog, click "Overwrite".

OBSERVED RESULT
- The editor displays a warning that the file ~/.cache/kioexec/run/<pid>_0/test.txt does not exist anymore.
- The kiod6 process is no longer running.
- The temporary directory ~/.cache/kioexec/run/<pid>_0 does not exist anymore, saving the file second time is not possible.

EXPECTED RESULT
It should be possible to save the file from the editor second time.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.8.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
It looks like the temporary directory is deleted by kiod6, which exits after the copy job is completed. I connected to a running kiod6 process with gdb, put a breakpoint on QDir::rmdir and confirmed that.

Then I put a breakpoint on QCoreApplicationPrivate::quitAutomatically, to find out why the process exits. Both stack traces are in the attached file.