Bug 407990 - Dolphin terminal panel doesn't source .zshrc on session restore
Summary: Dolphin terminal panel doesn't source .zshrc on session restore
Status: RESOLVED DUPLICATE of bug 279614
Alias: None
Product: dolphin
Classification: Applications
Component: panels: terminal (show other bugs)
Version: 21.07.80
Platform: Other Linux
: VHI normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
: 425141 426076 432037 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-05-27 10:28 UTC by Loïc Grobol
Modified: 2022-02-04 06:29 UTC (History)
25 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Dolphin after just started. (36.99 KB, image/png)
2021-12-26 19:12 UTC, Baltasar
Details
Dolphin after sourcing zshrc. (37.83 KB, image/png)
2021-12-26 19:13 UTC, Baltasar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Loïc Grobol 2019-05-27 10:28:18 UTC
SUMMARY
I have zsh as my default shell. Konsole and the other kparts (Kate, Yakuake) correctly source .zshrc at startup, but Dolphin doesn't when it is restoring at startup.


STEPS TO REPRODUCE
1. Have zsh as your default shell and something distinctive in .zshrc
2. Open dolphin and make sure the terminal panel is open (.zshrc should be correctly sourced at this point)
3. Log out and back in, the dolphin window should be restored

OBSERVED RESULT
The session in the terminal panel has not sourced .zshrc

EXPECTED RESULT
The terminal panel should have .zshrc correctly sourced


SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.15.5
KDE Frameworks Version: 5.57.à
Qt Version: 5.12.12

ADDITIONAL INFORMATION
zsh 5.5.1
Comment 1 Alcarinque Istar 2020-09-03 13:58:51 UTC
Hi, I can confirm this bug. Sourcing .zshrc in the terminal works fine. It also loads fine if I exit the session, by typing exit in the terminal, and load it again with F4. 

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.73.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION
zsh 5.8
Comment 2 Nate Graham 2020-09-06 23:25:05 UTC
*** Bug 425141 has been marked as a duplicate of this bug. ***
Comment 3 Nate Graham 2020-09-06 23:25:09 UTC
*** Bug 426076 has been marked as a duplicate of this bug. ***
Comment 4 d3coder 2020-11-16 10:19:51 UTC
I have same issue
Comment 5 Rafa 2020-12-23 16:27:30 UTC
I have the same problem. If you configure dolphin so that it does not restore the last session and always open by default HOME directory, dolphin's terminal sources .zshrc file correctly.
Comment 6 R David Dunphy 2021-01-11 15:16:23 UTC
I have the same issue with my .bashrc not being loaded, so it appears to not be limited to zsh. Changing the setting to always open $HOME in new sessions fixes it.
Comment 7 Nate Graham 2021-01-25 15:36:23 UTC
*** Bug 432037 has been marked as a duplicate of this bug. ***
Comment 8 olcay seker 2021-02-28 19:47:57 UTC
I have same issue with zsh too
Comment 9 yannl35133 2021-03-02 15:47:18 UTC
I also have the issue with bash in dolphin version 20.12.2
Comment 10 Dominik Kummer 2021-03-27 09:22:57 UTC
I also have the issue with bash in dolphin version 20.12.3

Dolphin services should restore After previous tabs did.

At first glance dolphinmainwindow.cpp#DolphinMainWindow::setupActions seems to activate Tabs after opening terminal, though I see no reason for this. Unfortunately I have no resources to contribute right now.
Comment 11 grannie 2021-04-08 17:15:02 UTC
i have the same issue
Comment 12 Dominik Kummer 2021-04-12 11:05:34 UTC
(In reply to Dominik Kummer from comment #10)
> I also have the issue with bash in dolphin version 20.12.3
> 
> Dolphin services should restore After previous tabs did.
> 
> At first glance dolphinmainwindow.cpp#DolphinMainWindow::setupActions seems
> to activate Tabs after opening terminal, though I see no reason for this.
> Unfortunately I have no resources to contribute right now.

Today it did work on
KDE Frameworks 5.80.0
Qt 5.15.2 (built against 5.15.2)
Comment 13 Zesko 2021-04-13 07:18:58 UTC
My suggestion:

When Dolphin is closed, its terminal panel/console is automatically closed or completely reset.

You start Dolphin and should manually click F4 to open the console and ZSH looks correct.
Comment 14 Marcello Massaro 2021-06-18 11:41:45 UTC
I have the same problem, but it's not ONLY when the session is restored. (as far as I can understand, if here "log-in/log-out" is being referred to as session)

If Dolphin is setup such that the terminal is already showing, .zshrc does not get sourced, even if you close and open Dolphin multiple times without logging out.

(In reply to Zesko from comment #13)
> You start Dolphin and should manually click F4 to open the console and ZSH
> looks correct.
I can confirm that this works as (annoying) workaround, and it does not matter that I'm not in my $HOME.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.22.0
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2
Dolphin Version: 21.04.2

ADDITIONAL INFORMATION
zsh 5.8
Comment 15 joel.bourquard 2021-07-21 11:37:22 UTC
Same here with bash and Dolphin 21.04.3.
As others have said, this is indeed related to this setting:
"Show on startup:  Folders, tabs and window state from last time"
If I change this to a fixed location (as a workaround), it works.
Comment 16 Sergey Frolov 2021-07-23 06:50:47 UTC
I've recently experienced a loss of my .bash_history records and traced it to this bug.  
My .bash_history was truncated from 2.5M to about 24k (default size) several times, until I was able to pinpoint dolphin as the source of this problem.

Given the user file corruption consequence, I think the relevant dolphin code should be disabled until the fix is available.
Comment 17 Ilya Bizyaev 2021-08-01 11:47:25 UTC
(In reply to Sergey Frolov from comment #16)
> I've recently experienced a loss of my .bash_history records and traced it
> to this bug.  
> My .bash_history was truncated from 2.5M to about 24k (default size) several
> times, until I was able to pinpoint dolphin as the source of this problem.
> 
> Given the user file corruption consequence, I think the relevant dolphin
> code should be disabled until the fix is available.

Wow, I also regularly lose my zsh history, would've never guessed it is caused by this bug...
Comment 18 Corbin 2021-10-30 23:47:18 UTC
Can confirm this affects zsh still. I tried to replicate it in the latest KDE Neon (dev) using both bash and zsh. To see if the rc file was sourced, I placed the command "touch ~/test" inside it.

In bash:
When starting dolphin and the konsole is closed, the test file isn't created until I open the terminal (with a button or via F4). 
When starting dolphin and the konsole is open from the previous session (session being the last time I had dolphin open), the test file is immediately created. 
Repeatedly opening and closing the terminal doesn't create the test file again in either case (so the rc is only sourced once).
-> This is entirely the expected behavior.

In zsh:
When starting dolphin and the konsole is closed, behavior is identical to bash.
When starting dolphin and the konsole is open from the previous session, no test file is created.
Repeatedly opening and closing the terminal doesn't create the test file again (or at all, in case 2).
-> When starting dolphin with konsole set to open, initializing the z-shell with its corresponding zshrc file is skipped.
-> This is the bug.

Skipping the rc file also ruins prompts and aliases, since it leaves you with a completely bare-bones un-configured shell, which is borderline unusable.
The only workaround is to close the embedded konsole and restart dolphin.
Comment 19 Jay Armstrong 2021-12-23 12:49:36 UTC
Believe I'm seeing the same issue using fish shell.

Plasma 5.18.6
Comment 20 Baltasar 2021-12-26 19:12:04 UTC
Created attachment 144882 [details]
Dolphin after just started.

Dolphin shows zsh with the default config.
Comment 21 Baltasar 2021-12-26 19:13:12 UTC
Created attachment 144883 [details]
Dolphin after sourcing zshrc.

After sourcing zshrc, the terminal panel behaves as expected.
Comment 22 Baltasar 2021-12-26 19:16:36 UTC
Same here.
However, in my case Dolphin never loads zshrc for the terminal panel; no matter the situation.
Please refer to the attachments provided: Dolphin after just started, and Dolphin after sourcing zshrc.
Konsole or Yakuake work as expected.
===
$ inxi
CPU: quad core Intel Core i7-7700 (-MT MCP-) speed/min/max: 800/800/4200 MHz
Kernel: 5.15.7-1-MANJARO x86_64 Up: 4d 22h 53m
Mem: 5369.0/32064.3 MiB (16.7%) Storage: 465.76 GiB (77.4% used) Procs: 259
Shell: Zsh inxi: 3.3.11
 $ uname -a 
Linux baltasar-pc 5.15.7-1-MANJARO #1 SMP PREEMPT Wed Dec 8 10:09:19 UTC 2021 x86_64 GNU/Linux
 $ cat /etc/passwd | grep baltasarq
baltasarq:x:1000:1000:Baltasar:/home/baltasarq:/bin/zsh
===
Comment 23 Bharadwaj Raju 2022-02-04 06:29:20 UTC

*** This bug has been marked as a duplicate of bug 279614 ***