SUMMARY When Konsole is launched from Dolphin using "Open Terminal Here"(Alt+Shift+F4), the process is launched in the directory specified and the CWD remains unchanged for the duration of the lifespan of the process. If the CWD happens to be a removeable mount point, say a USB flash drive, a external HDD or a network mount, the kernel will complain that the mount point is still in use. You were left with only two options: either terminate the process or do lazy unmount. But wait, it gets worse! Note that the subsequent new windows and tabs will share the same CWD. All of the sessions will share the same CWD. STEPS TO REPRODUCE 1. In Dolphin, navigate to a removable storage device 2. Launch Konsole via right click context menu("Open Terminal Here") or the shortcut key 3. In the launched Konsole, run `cd` to change CWD from the removable location 4. Run `pstree -ap $PPID; lsof -p $PPID -a -d cwd` in the launched Konsole to confirm that the Qt process still has its CWD to set the removable mount point 5. Try unmounting the device OBSERVED RESULT Unable to unmount the device because the CWD of the Konsole process(not the bash inside it) is set to the removable mount point. EXPECTED RESULT Able to unmount the device as no process is holding the removable mount point as CWD. ADDITIONAL INFORMATION Suggested fix: https://invent.kde.org/dxdt/konsole/-/commit/33b189fe690d105cadb18c36fc8200cbdbddf9a1 Related patch: https://gitlab.gnome.org/GNOME/nautilus/-/issues/3824
The identical feature in GNOME(Nautilus-open-terminal) does not suffer from the same issue as evident in the link provided. The same behaviour was observed with the Windows version as well. The patch should fix the issue on all platforms. Trivia: Windows' explorer.exe has the same issue that needs to be addressed. The directory handle of the main process remains unchanged even after the child process(powershell.exe) cd's.
Correction: lazy unmount won't fix any problem as the file system's dirty bit will only clear when the last process closes the last fd on the file system. Also, lazy unmount does not guarantee fs sync. The safest bet is to terminate the Konsole processes holding the directory. This bug has to be fixed.
I don't think Konsole should start to change the working dir, that will break all relative command line arguments and Co. The fix should be on the side that launches the process.
(In reply to Christoph Cullmann from comment #3) > I don't think Konsole should start to change the working dir, that will > break all relative command line arguments and Co. > > The fix should be on the side that launches the process. Mate, did you even read the code? Are you even the maintainer of the project? The wd is still logically saved. The problem is the CWD of the process. If you don't even understand the last sentence, stay out of it.
This is NOT a Dolphin issue. Whoever changed the bug, thoroughly read the report and all the links before passing it to the other project. Dolphin can be used with other terminal emulators. Terminal emulators usually expects the parent process to set the CWD so it can pass it onto the underlying process(bash, shell script, executable, etc). If you doubt me, read up on the original xterm code. That behaviour is universal across all the terminal emulators today. The UI process(Qt) should hand off the CWD after launching the child process. The wd is saved in the session object. Subsequent tabs, windows inherit that data, not the CWD. If you(whoever's in charge) still think this is a Dolphin problem, you might as well just close it. It's not that important. GNOME terminal/ptyaxis seems to be the only term emulator that's been written by a dev competent enough to think this through. Can't believe I have to defend my case when I'm basically serving the bug report with the working patch on a silver platter. Has anyone even applied the patch and actually built it and ran it to come to that conclusion of "doesn't fix the problem"? Give me one good example case where the fix doesn't work or becomes a problem.
(In reply to dxdt from comment #4) > (In reply to Christoph Cullmann from comment #3) > > I don't think Konsole should start to change the working dir, that will > > break all relative command line arguments and Co. > > > > The fix should be on the side that launches the process. > > Mate, did you even read the code? Are you even the maintainer of the project? > > The wd is still logically saved. The problem is the CWD of the process. If > you don't even understand the last sentence, stay out of it. Changing the CWD of the process will do what I said... I has implications on all cases we don't have already made paths absolute. And reading the code in Dolphin, we use there KTerminalLauncherJob, which could handle that better. And I think your aggressive tone is not that helpful. Did I close your bug or did I say I don't see that is an issue that one should not fix? Btw., I did read the linked nautilus bug, and there the working dir was 'fixed' in nautilus to avoid one uses the 'wrong' one for the called process.
> And reading the code in Dolphin, we use there KTerminalLauncherJob, which could handle that better. Talking about KDEism. You guys are not the only DE out there. Yeah, sure. change Dolphin. Who cares about interoperability? Isolate yourself from the rest of the GUI apps. > And I think your aggressive tone is not that helpful. I don't respond well to incompetence and neither should you. I give up. Do whatever you want with your project. I already lost faith in KDE. I did what I could. No more input from me. Good luck chap.