Bug 391380 - Folder change not always in sync with terminal component
Summary: Folder change not always in sync with terminal component
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: panels: terminal (show other bugs)
Version: 17.12.2
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
: 449650 452788 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-03-04 15:13 UTC by kde
Modified: 2022-04-27 18:49 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 22.04.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kde 2018-03-04 15:13:39 UTC
The KPart-terminal that is brought up with F4 in Dolphin should stay in sync with folder changes in Dolphin I think.

Sometimes when changing folders however, the terminal session keeps the old working directory.

I could not find a way to reliably reproduce this, it just happens sometimes, and sometimes it doesn't. Bringin up the F4 terminal and changing around folders for a while will sooner or later show the bug however.
Comment 1 Nate Graham 2018-03-29 20:54:25 UTC
It's definitely supposed to, and generally does.

Unfortunately, without a way to reproduce the issue, there's no way to debug your issue. If you do manage to find a reliable set of Steps To Reproduce, please feel free to re-open the bug and add them here. See https://community.kde.org/Get_Involved/Bug_Reporting#Steps_to_Reproduce
Comment 2 kde 2018-05-03 18:42:28 UTC
I can confirm it still happens on 18.04.0

Steps to reproduce:
1. open Dolphin
2. click on folder
3. press enter to open it
4. press backspace to leave
5. do steps 3 and 4 repeatedly
6. sooner or later, the folder change won't happen in the embedded terminal anymore
Comment 3 kde 2018-05-03 18:43:04 UTC
step 1.5, open Terminal with F4
Comment 4 kde 2018-10-12 22:58:44 UTC
The issue still persists with Applications 18.08.1

When changing folders with the builtin F4-terminal and Enter/Backspace keys as described above, it syncs the folder change *if* I enter/leave the folder only once a second, it starts bugging out when I do it faster.
Maybe this means there is a race condition somewhere?
Comment 5 Alexander Kowalski 2020-08-01 16:44:22 UTC
This bug has a side effect that regularly happens to me and has been annoying me for years: When I leave a directory, let's call it "dir", but the working directory of the shell does not change and I then delete the directory, that will be interpreted as a directory change to "dir (deleted)" in the terminal and that will sync, so the directory view navigates to "dir (deleted)" showing no contents and an error message that the directory does not exist. I am not sure how I manage to trigger this as often as I do, but I assume it is because I probably often have the directory and its parent directory both open in a split view and then at some point while working in the parent directory when I want to delete the directory I quickly change to its view to close it and that makes the shell go in there, but the closing follows too quickly to make it leave again.

I took some time to debug this issue and it seems to occur because there is a significant (about 0.5 to 1 s on my system I would guess) delay between the call to `sendCdToTerminal` that sends the cd command to the shell and the execution of the slot `slotKonsolePartCurrentDirectoryChanged` which is caused by the shell changing its directory (all references are to src/panels/terminal/terminalpanel.cpp of the code currently on the git master branch). This can at least partially be fixed by not doing the check for `dir == m_konsolePartCurrentDirectory` at the beginning of `sendCdToTerminal` and instead always sending the cd command because `m_konsolePartCurrentDirectory` is incorrect if the slot has not yet been executed after the previous call. However, as far as I can tell, when quickly navigating between directories how often and when exactly the slot is called is somewhat unreliable and with this change only, some entries might be left in `m_sendCdToTerminalHistory`. If you then change to one of those directories in the terminal, the directory view does not follow. It would be quite nice if someone could at least fix this sufficiently that what I described in the first paragraph does not happen any more, but I can not see an easy way to make it work correctly under all circumstances right now. (But I also have absolutely no experience working on dolphin or any KDE software for that matter.)

Also, it seems to me that bug 421337 is a duplicate of this bug and possibly bug 416690 as well, although I am not so sure about that one.
Comment 6 Patrick Silva 2021-11-19 20:32:32 UTC
I was affeted by this bug a few minutes ago on Arch Linux running Dolphin 21.12 beta.

Operating System: Arch Linux
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Graphics Platform: Wayland
Comment 7 Patrick Silva 2022-02-05 14:37:12 UTC
*** Bug 449650 has been marked as a duplicate of this bug. ***
Comment 8 Patrick Silva 2022-04-20 13:21:49 UTC
*** Bug 452788 has been marked as a duplicate of this bug. ***
Comment 9 Felix Ernst 2022-04-22 13:38:06 UTC
I opened a merge request: https://invent.kde.org/system/dolphin/-/merge_requests/382
Comment 10 Felix Ernst 2022-04-27 10:40:44 UTC
Git commit e70e12e3bdf3ce4e9cca4c8f003655ea10b21d7e by Felix Ernst.
Committed on 27/04/2022 at 10:40.
Pushed by felixernst into branch 'release/22.04'.

Fix terminal panel not keeping up with dir changes

The terminal panel is supposed to show the same location as the
currently active Dolphin view at all times.

However there was an issue when the terminal is supposed to
quickly switch to a new location and then back again to the old
one. The terminal ignored the switch to the old location unless it
had already fully switched to the new location. Because it isn't
particularly fast at fully switching to the new location, it would
never do the expected thing of switching back to the old location.

This commit makes it so the switch to the old location is only
ignored if there are no in-progress switches to a different
location.
Related: bug 416690

FIXED-IN: 22.04.2

Not totally sure if this fixes everything but it seems like an improvement.

M  +5    -3    src/panels/terminal/terminalpanel.cpp

https://invent.kde.org/system/dolphin/commit/e70e12e3bdf3ce4e9cca4c8f003655ea10b21d7e