Bug 279614 - The Dolphin shell panel (opened by F4) does not source .bashrc when opened by session restore
Summary: The Dolphin shell panel (opened by F4) does not source .bashrc when opened by...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: panels: terminal (show other bugs)
Version: 20.12.2
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: John Brooks
URL:
Keywords:
: 407990 431044 445774 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-08-07 20:39 UTC by Goran Brannstrom
Modified: 2022-11-20 21:47 UTC (History)
31 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Goran Brannstrom 2011-08-07 20:39:14 UTC
Version:           1.7 (using KDE 4.7.0) 
OS:                Linux

Since I installed KDE 4.7.0 in Kubuntu, whenever I open a new Doplhin shell panel (with F4) I have to manually source ~/.bashrc in order to get my settings and aliases. I love the shell panel, and use it all the time. This is a really frustrating regression. 

Reproducible: Always

Steps to Reproduce:
Start Dolphin. If not already open, enable the Dolhpin shell panel using F4-button. Check aliases ($ alaises) or your environment ($ env) to see that no user initialization has occured.

Actual Results:  
It seem no other initialization files has been sourced, other than system-wide /etc/bashrc possibly. 

Expected Results:  
Whenever you open a shell panel, your shells init file should be sourced. Whether it be ~/.bashrc or whatever the environment is configured to source-

I installed KDE 4.7.0 using a PPA repo. If that is the only reason this behaviour occurs then my bad. I only wish to help out.
Comment 1 Goran Brannstrom 2011-08-07 20:45:16 UTC
Sorry for the bad spelling of "Dolphin" and "$ aliases" :-)
Comment 2 Olivier Subilia 2011-09-01 18:38:46 UTC
Can confirm the bug. I installed KDE 4.7.0 using http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu
Comment 3 Jekyll Wu 2011-09-22 08:08:07 UTC
If ~/.bashrc is not sourced, the possible reason is:

The default profile used by konsole & terminal-panel runs a login bash(bash -l), and ~/.bash_profile does not contain the line of sourcing ~/.bashrc.

Try open konsole and check with the default profile in use.
Comment 4 Goran Brannstrom 2011-09-22 17:57:50 UTC
Hi!

Thanks for suggestions!

I added:

# Source .bashrc
[ -f ~/.bashrc ] && source ~/.bashrc

In my ~/.bash_profile

But to no avail. ~/bash_profile is not sourced by the Dolphin shell panel.
Period. Not in my version of Dolphin (4.7.0).

I have this line and a lot of other stuf, like aliases being defined in
~/.bash_profile, that is never executed.
echo "Sourcing profile  [ ~/.bash_profile  ]"

The only file that is sourced is: /etc/bash.bashrc

So much I can confirm by defining an alias there. Such as this kludge I have
used to make life slightly more bearable:
alias sbrc="source ~/.bashrc"

On the other hand. Should I source ~/.bashrc from /etc/bash.bashrc?  Would
it hurt? It seems not to be the norm.

Funny thing is, if you start an external shell window using Shift + F4, then
everything works the way you expect. Both /etc/bash.bashrc and the personal
~/.bashrc is sourced.  Why cannot F4 work the same way? That would be
easier.


/Göran

2011/9/22 Jekyll Wu <adaptee@gmail.com>

> https://bugs.kde.org/show_bug.cgi?id=279614
>
>
> Jekyll Wu <adaptee@gmail.com> changed:
>
>           What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                 CC|                            |adaptee@gmail.com
>
>
>
>
> --- Comment #3 from Jekyll Wu <adaptee gmail com>  2011-09-22 08:08:07 ---
> If ~/.bashrc is not sourced, the possible reason is:
>
> The default profile used by konsole & terminal-panel runs a login bash(bash
> -l), and ~/.bash_profile does not contain the line of sourcing ~/.bashrc.
>
> Try open konsole and check with the default profile in use.
>
> --
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>
Comment 5 Goran Brannstrom 2011-09-22 18:53:03 UTC
Hi!

I quitted all my invocations of Dolphin and then tried again. Now it seems
to work as expected! Yeah!

Thanks!

BTW, does Dolphin have a comman line argument that makes it start in a
certain directory?

The icon setting "Work path" only makes it open a "Save as" dialog in this
place, not show that directory per default.

/Göran


2011/9/22 Goran Brannstrom <goranbr@gmail.com>

> Hi!
>
> Thanks for suggestions!
>
> I added:
>
> # Source .bashrc
> [ -f ~/.bashrc ] && source ~/.bashrc
>
> In my ~/.bash_profile
>
> But to no avail. ~/bash_profile is not sourced by the Dolphin shell panel.
> Period. Not in my version of Dolphin (4.7.0).
>
> I have this line and a lot of other stuf, like aliases being defined in
> ~/.bash_profile, that is never executed.
> echo "Sourcing profile  [ ~/.bash_profile  ]"
>
> The only file that is sourced is: /etc/bash.bashrc
>
> So much I can confirm by defining an alias there. Such as this kludge I
> have used to make life slightly more bearable:
> alias sbrc="source ~/.bashrc"
>
> On the other hand. Should I source ~/.bashrc from /etc/bash.bashrc?  Would
> it hurt? It seems not to be the norm.
>
> Funny thing is, if you start an external shell window using Shift + F4,
> then everything works the way you expect. Both /etc/bash.bashrc and the
> personal ~/.bashrc is sourced.  Why cannot F4 work the same way? That would
> be easier.
>
>
> /Göran
>
>
> 2011/9/22 Jekyll Wu <adaptee@gmail.com>
>
>> https://bugs.kde.org/show_bug.cgi?id=279614
>>
>>
>> Jekyll Wu <adaptee@gmail.com> changed:
>>
>>           What    |Removed                     |Added
>>
>> ----------------------------------------------------------------------------
>>                 CC|                            |adaptee@gmail.com
>>
>>
>>
>>
>> --- Comment #3 from Jekyll Wu <adaptee gmail com>  2011-09-22 08:08:07 ---
>> If ~/.bashrc is not sourced, the possible reason is:
>>
>> The default profile used by konsole & terminal-panel runs a login
>> bash(bash
>> -l), and ~/.bash_profile does not contain the line of sourcing ~/.bashrc.
>>
>> Try open konsole and check with the default profile in use.
>>
>> --
>> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
>> ------- You are receiving this mail because: -------
>> You reported the bug.
>>
>
>
>
> --
> ** The funniest thing about this signature is that by the time you realize
> it doesn't say anything it's too late to stop reading it. **
>
Comment 6 Goran Brannstrom 2011-09-22 19:22:26 UTC
Hi!

I experimented some more. It turns out that if you start dolphin with a url
as in:

$ dolphin /home/shared/pictures

Then the ~/.bashrc is not sourced.

If you omit any URL It is sourced the way you expect. Is there a reason for
that?

/Göran

2011/9/22 Goran Brannstrom <goranbr@gmail.com>

> Hi!
>
> I quitted all my invocations of Dolphin and then tried again. Now it seems
> to work as expected! Yeah!
>
> Thanks!
>
> BTW, does Dolphin have a comman line argument that makes it start in a
> certain directory?
>
> The icon setting "Work path" only makes it open a "Save as" dialog in this
> place, not show that directory per default.
>
> /Göran
>
>
>
> 2011/9/22 Goran Brannstrom <goranbr@gmail.com>
>
>> Hi!
>>
>> Thanks for suggestions!
>>
>> I added:
>>
>> # Source .bashrc
>> [ -f ~/.bashrc ] && source ~/.bashrc
>>
>> In my ~/.bash_profile
>>
>> But to no avail. ~/bash_profile is not sourced by the Dolphin shell panel.
>> Period. Not in my version of Dolphin (4.7.0).
>>
>> I have this line and a lot of other stuf, like aliases being defined in
>> ~/.bash_profile, that is never executed.
>> echo "Sourcing profile  [ ~/.bash_profile  ]"
>>
>> The only file that is sourced is: /etc/bash.bashrc
>>
>> So much I can confirm by defining an alias there. Such as this kludge I
>> have used to make life slightly more bearable:
>> alias sbrc="source ~/.bashrc"
>>
>> On the other hand. Should I source ~/.bashrc from /etc/bash.bashrc?  Would
>> it hurt? It seems not to be the norm.
>>
>> Funny thing is, if you start an external shell window using Shift + F4,
>> then everything works the way you expect. Both /etc/bash.bashrc and the
>> personal ~/.bashrc is sourced.  Why cannot F4 work the same way? That would
>> be easier.
>>
>>
>> /Göran
>>
>>
>> 2011/9/22 Jekyll Wu <adaptee@gmail.com>
>>
>>> https://bugs.kde.org/show_bug.cgi?id=279614
>>>
>>>
>>> Jekyll Wu <adaptee@gmail.com> changed:
>>>
>>>           What    |Removed                     |Added
>>>
>>> ----------------------------------------------------------------------------
>>>                 CC|                            |adaptee@gmail.com
>>>
>>>
>>>
>>>
>>> --- Comment #3 from Jekyll Wu <adaptee gmail com>  2011-09-22 08:08:07
>>> ---
>>> If ~/.bashrc is not sourced, the possible reason is:
>>>
>>> The default profile used by konsole & terminal-panel runs a login
>>> bash(bash
>>> -l), and ~/.bash_profile does not contain the line of sourcing ~/.bashrc.
>>>
>>> Try open konsole and check with the default profile in use.
>>>
>>> --
>>> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
>>> ------- You are receiving this mail because: -------
>>> You reported the bug.
>>>
>>
>>
>>
>> --
>> ** The funniest thing about this signature is that by the time you realize
>> it doesn't say anything it's too late to stop reading it. **
>>
>
>
>
> --
> ** The funniest thing about this signature is that by the time you realize
> it doesn't say anything it's too late to stop reading it. **
>
Comment 7 Jekyll Wu 2011-09-22 20:31:28 UTC
(In reply to comment #6)
> 

Yeah, I observed the same result. This is really weird. I guess the is something wrong with how dolphin interacts with the kpart provided by konsole, i.e, the terminal-panel.

Just out of curiosity, I repeated the similar operation with kate, which also uses konsole kpart. It turns out kate behaves in the same way( ~/.bashrc is sourced) when invoked as 'kate' and 'kate somefile' .

So, could some dolphin developer give a hint why dolphin/terminal-panel behaves differently when invoked with an URL?
Comment 8 Goran Brannstrom 2011-09-22 20:44:43 UTC
Hi!

Summary of the problem:

If you create a shortcut to a directory, using Dolphin, and then click on that
shortcut then the shell-view will not source ~/.bashrc. Bad Dolphin!  :-(

N.B: For shortcuts to use Dolphin, I have set my default File Manager to be
Dolphin in System Settings/Default Applications

Neither will the shell-view source ~/.bashrc if started at CLI with a URL:
$ dolphin /home/goran/pictures
Bad Dolphin!  :-(

If you click the ordinary icon for Dolphin in the start menu, the shell-view
(F4) will source ~/.bashrc as expected. Good Dolphin! :-)

To sum it up:

- If Dolphin is started by clicking its icon in the menu, all is honky dory.
  I.e, Dolhphin sources ~/.bash_profile or possibly ~/.bashrc.

- If started in any other way, it does NOT source ~/.bash_profile nor ~/.bashrc.

N.B: I even tried to create and then edit a Dolphin shortcut so that the command would add the path as an argument at the end. Result: No ~/.bash* sourcing.

N.B: I source ~/.bashrc from my ~/.bash_profile, so any one of them would be satisfactory to source from the Dolphin shell-view. 

/Göran
Comment 9 Jekyll Wu 2011-10-26 11:45:25 UTC
(In reply to comment #7)

Interesting,after upgrading to KDE-4.7.2, I can't reproduce the previously observed problem with dolphin any more.
Comment 10 Goran Brannstrom 2011-10-26 12:17:01 UTC
I also use KDE 4.7.2. and still have this problem. Not just once in a while, but with the unfailing certainty of Death and Taxes.  :-)

Does anyone claim to have fixed this? Has it been adressed? It would be the best Christmas gift ever if this worked as expected.

/Göran
Comment 11 Goran Brannstrom 2011-11-09 21:04:46 UTC
FYI: Bug still remains in KDE 4.7.3.
Comment 12 Ed Biow 2011-11-10 23:05:40 UTC
It seems that the problem extends to the dolphin terminal emulator as well as with the F4 free-standing terminal.  I played with the Profile settings and couldn't find anything that fixed it.  One additional wrinkle, once you "source ~/.bashrc" you can close dolphin and re-open it and the re-opened dolphin will remember that .bash* has been sourced. I don't know if the konqueror terminal emulator shares this issue (I've already sourced .bashrc this session in dolphin), but then, I rarely use konqueror these days as a common file manager because of a long unaddressed bug; konqueror does not synchronise the terminal emulator with the directory of the current active view file manager pane. https://bugs.kde.org/show_bug.cgi?id=245102  I never had this problem with KDE3.x.
Comment 13 Evstifeev Roman 2011-11-13 14:19:56 UTC
The problem can be solved only temporarily by closing all dolphin instances. After reboot (and sesson restore) *some* of dolphin windows has sourced .bashrc and friends in terminal panel, and some of the restored windows are not.

Another weird thing with dolphin terminal (may be related):
Sometimes after session restore *some* restored dolphin terminal windows have wrong bash prompt + not sourced bashrc. (while some of them has correct prompt, but no .bashrc sourced, as stated in this bugreport)
Comment 14 Evstifeev Roman 2011-11-13 14:23:25 UTC
As far as i remember - this bug does not exist in KDE 4.6.x
Comment 15 Jekyll Wu 2011-12-31 02:50:54 UTC
Well, I just realize another key condition(in addition to the URL argument on the command line) to reproduce the problem when using KDE SC 4.7.x. The terminal panel must be visible initially on startup, instead of being hidden initially.

The good news is I can't reproduce the problem in any way when using dolphin 2.0 in KDE SC 4.8 .
Comment 16 Evstifeev Roman 2012-01-28 18:49:37 UTC
i am running KDE SC 4.8 and still can reproduce this problem
Comment 17 Goran Brannstrom 2012-04-03 13:27:47 UTC
I run KDE SC 4.8.1 at home and Dolphin still has this bug in this version.
Comment 18 Jeroen van Meeuwen (Kolab Systems) 2012-08-24 16:21:31 UTC
Resetting assignee to default as per bug #305719
Comment 19 Bjoern Olausson 2012-10-16 08:02:43 UTC
Bug is gone for me in KDE 4.9.2 (at least I can't reproduce it anymore).

Cheers,
Bjoern
Comment 20 Goran Brannstrom 2012-10-16 08:14:00 UTC
I'm running KDE 4.9.2 and I had to source my .bashrc manually as recently as last evening.

I have a feeling that it has occured less frequently than before, or rather in fewer situations, and I will try to see in which circumstances this occurs. 

Either way, it's not yet resolved in all situations, in my experience.

/Goran
Comment 21 Adrián Chaves (Gallaecio) 2012-11-01 15:57:50 UTC
Please, Goran, try to provide a set of steps to reproduce the issue in 4.9.2.
Comment 22 Goran Brannstrom 2012-11-01 19:10:55 UTC
I think I have concluded now that it's a question of how Dolphin is started.

If I start a new Dolphin instance from the start menu everything works fine.  Whether Dolphin starts with the shell panel or not, .bash-files are sourced when the F4 is used to enable the panel. Good!

However, If I have Dolphin instances running when I log out from KDE, like I usually have, those instances will be restored again when I log in. BUT....in these restored instances the shell panel will not have sourced the .bash* files. It would be very convenient if these "restored" instances also sourced my .bash* files.  Don't you agree? :-)

/Goran
Comment 23 Jekyll Wu 2012-11-01 19:22:00 UTC
Thanks for the updated information.  I will try to reproduce and  investigate.
Comment 24 Olivier Subilia 2012-11-01 23:13:33 UTC
Workaround:

I can't always reproduce the bug (depends obviously of how an when I previously opened Dolphin in the current session). But there is a real easy workaround:

ctrl-D (log out the pannel) than immediatly F4 (recreate the pannel). After a first logout, the pannel always source .bashrc. On the other hand, F4 twice doesn't do anything (F4 just hide/show). The trick is in the logout than new pannel.

Maybe the (easy) workaround could show a way to investigate.
Comment 25 Andrew Belitsky 2015-01-26 18:58:24 UTC
I have a similar problem. Terminal panel doesn't source .bashrc if Dolphin restores with a session and terminal is opened.
But if terminal is closed I press F4 and see that .bashrc is sourced. Version is 4.14.3.
Comment 26 Kevin Shepherd 2015-12-16 14:07:36 UTC
Still happening in Dolphin v15.08.2 KDE v5.15.0
Olivier's workaround works ( Thanks Olivier ) - CTRL-D F4
I am happy to provide any logs that might help.
Comment 27 Julian Steinmann 2018-04-17 12:33:00 UTC
I cannot reproduce this bug when doing the following steps:
1. Open Dolphin by invoking "dolphin /home/.../Downloads"
2. Pressing F4 to open up the terminal panel
3. Logging out
4. Logging back in

The panel correctly sources all my aliases.

This has been done with Dolphin 17.12.3. Can anybody else confirm that this issue is no longer happening?
Comment 28 Julian Steinmann 2018-05-05 18:43:21 UTC
If nobody responds in the next two weeks, I'll assume that this bug is indeed fixed.
Comment 29 Bjoern Olausson 2018-05-05 21:04:37 UTC
(In reply to Julian Schraner from comment #28)
> If nobody responds in the next two weeks, I'll assume that this bug is
> indeed fixed.

Sorry, but I can't test it any more.

Greetings,
Bjoern
Comment 30 Goran Brannstrom 2018-05-05 21:20:45 UTC
Hi!

I can no longer reproduce this error.
Comment 31 Julian Steinmann 2018-05-06 09:23:12 UTC
Okay, thanks @Goran for the response. I will therefore close this bug now. Please reopen the report if you can still reproduce the behavior with newer versions of Dolphin. Thanks!
Comment 32 gena 2018-05-07 08:15:52 UTC
Hi!

I've tested dolphin 18.04.0 (KF 5.44.0, Qt 5.10.1) on debian testing amd64 and sometimes (not always!) after reboot I see that dolphin doesn't source my bashrc. I think it's somehow connected with the option "Restore previous session" on login.
Comment 33 Karl Ove Hufthammer 2019-07-28 08:46:26 UTC
I can confirm this bug and *reliably reproduce* it for a current version of Dolphin.

Note: This only happens for a Dolphin window opened by the ‘session restore’ feature. For manually opened Dolphin windows, everything is fine.

STEPS TO REPRODUCE
1. Open at least one Dolphin windows. Open the terminal (F4) inside Dolphin.
2. Log out.
3. Log in.


OBSERVED RESULT
The Dolphin window is restored, including the opened terminal pane, but ~/.bashrc has not been executed in the terminal pane. For example, aliases defined in ~/.bashrc are not available. Closing and reopening the terminal (F4) doesn’t help.

However, if you open a *new* Dolphin window, ~/.bashrc *is* sourced in the terminal in this *new* window.


ADDITIONAL INFORMATION
It is useful to have an easy way of seeing whether ~/.bashrc has been sourced. I have a colourful prompt defined in my ~/.bashrc file, which make it very easy (if the file has been sourced, the prompt is green and purple, if not, it’s grey). I use the following command for this:

  export PS1="\[\e[0;32m\]\u@\h \[\e[0;35m\]\W\[\e[m\]$ "


SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20190723
KDE Plasma Version: 5.16.2
KDE Frameworks Version: 5.59.0
KDE Applications Version: 19.04.3
Qt Version: 5.13.0
Kernel Version: 5.2.1-1-default
OS Type: 64-bit
Comment 34 Karl Ove Hufthammer 2019-07-28 08:46:45 UTC
I can confirm this bug and *reliably reproduce* it for a current version of Dolphin.

Note: This only happens for a Dolphin window opened by the ‘session restore’ feature. For manually opened Dolphin windows, everything is fine.

STEPS TO REPRODUCE
1. Open at least one Dolphin windows. Open the terminal (F4) inside Dolphin.
2. Log out.
3. Log in.


OBSERVED RESULT
The Dolphin window is restored, including the opened terminal pane, but ~/.bashrc has not been executed in the terminal pane. For example, aliases defined in ~/.bashrc are not available. Closing and reopening the terminal (F4) doesn’t help.

However, if you open a *new* Dolphin window, ~/.bashrc *is* sourced in the terminal in this *new* window.


ADDITIONAL INFORMATION
It is useful to have an easy way of seeing whether ~/.bashrc has been sourced. I have a colourful prompt defined in my ~/.bashrc file, which make it very easy (if the file has been sourced, the prompt is green and purple, if not, it’s grey). I use the following command for this:

  export PS1="\[\e[0;32m\]\u@\h \[\e[0;35m\]\W\[\e[m\]$ "


SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20190723
KDE Plasma Version: 5.16.2
KDE Frameworks Version: 5.59.0
KDE Applications Version: 19.04.3
Qt Version: 5.13.0
Kernel Version: 5.2.1-1-default
OS Type: 64-bit
Comment 35 Ezike Ebuka 2020-09-30 00:45:43 UTC
i am also currently experiencing this issue too on  
distro : Manjaro 
Plasma version: 5.19.5 
frameworks: 5.74.0 
Qt 5.15.1.
Comment 36 Nate Graham 2021-01-05 02:57:38 UTC
*** Bug 431044 has been marked as a duplicate of this bug. ***
Comment 37 Luigi Keith 2021-01-05 19:44:52 UTC
I have similar issue regarding this except it occurs without session restore.

Sourcing is interrupted at line #221 in terminalpanel.cpp. Restoring panel at dolphin start calls function twice with second call sending SIGINT to konsole instance.
https://invent.kde.org/system/dolphin/-/blob/master/src/panels/terminal/terminalpanel.cpp#L221
Comment 38 Aurélien Oudelet (auroud85_fr) 2021-02-07 16:15:31 UTC
I don't know if this is related but:

Dolphin 20.12.1 has an option to
Show on startup: "Folders, tabs, window state of last time"(A) or a user's selected directory (B), in Startup pane of Dolphin's preferences.

When the above (A) option is selected and a Terminal pane was previously opened, a new instance of Dolphin has this Terminal pane without colors outputs.

But, if (B) option is selected, the same Terminal pane has colors outputs...

It seems the (A) option relies on a Restore Session functionality...
If you consider that this is not related, I shall open a new BR.

(This was previously reported in Mageia's Bugzilla at: https://bugs.mageia.org/show_bug.cgi?id=28309

Aurelien O.
Mageia Bugsquad Team.
Comment 39 Matthias Mailänder 2021-03-04 17:05:54 UTC
This happens on openSUSE Tumbleweed, but somehow not on openSUSE Leap 15.2.
Comment 40 Matthias Mailänder 2021-03-04 17:08:44 UTC
I can also confirm that setting Start to a static folder instead of the previous one resolves it. Tested on Dolphin version 20.12.2
Comment 41 Landgraf132 2021-10-21 08:05:44 UTC
KDE 5.23.1
Dolphin 21.08.2
If in dolphin enabled conf Startup->Show on startup: Folder, tabs, and window state from last time, then dolphin shell panel don't read .bashrc.
Comment 42 Goran Brannstrom 2021-10-21 09:24:53 UTC
Upgraded to Kubuntu Impish Indra (21.10) yesterday. But unfortunately this issue is it's still not solved. I just realized, I logged this more than ten years ago, and I'm starting to wonder whether this behavior is considered a bug or made this way by design...and I am trying to do the impossible? :-) 

Current version tried:
- Dolphin Version 21.08.1
- KDE Frameworks 5.86.0
- Qt 5.15.2 (built against 5.15.2)

I can confirm that setting the start directory to a static directory makes Dolphin source .bashrc in the F4 panel, but when we now know that setting it to the default "Folders, window state from last time" makes Dolphin forget to source .bashrc - shouldn't that be a clear indication of where the sourcing problem might lie? Just a suggestion...

I mean, configuring Dolphin to always open on the same directory may be a workaround, but hardly solution. At least not a practical one. I have several dolphin windows open every time I boot up, at favorite places where I usually work. I'm sure others have too. It would be so sweet if this could be made to work automatically. Or by some more practical workaround than by circumventing the ability for dolphin to remember where it last was.
Comment 43 Luigi Keith 2021-11-19 22:35:40 UTC
You can fix this without making changes to souce code by simply making your .bashrc file as follows:

trap : SIGINT
## YOUR BASHRC CONTENT ##
trap - SIGINT

This redirects any interrup signals to null- command during the sourcing phase and clears after sourcing has been done.

Why:
- Dolphin opens with the tabs opened in the last session.
- Dolphin parses all the paths of the tabs and starts calling directory changes to the terminal.
- Dolphin has a failsafe feature when calling directory changes*[1]. It sends SIGINT to terminal process before changing directory.
- This results in terminal (bash) interrupting .bashrc / .bash_profile parsing.

[1] panels/terminal/terminalpanel.cpp: TerminalPanel::sendCdToTerminal
        // The TerminalV2 interface does not provide a way to delete the
        // current line before sending a new input. This is mandatory,
        // otherwise sending a 'cd x' to a existing 'rm -rf *' might
        // result in data loss. As workaround SIGINT is sent.
        const int processId = m_terminal->terminalProcessId();
        if (processId > 0) {
            kill(processId, SIGINT);
        }
Comment 44 karolbienkowski 2022-01-18 18:50:06 UTC
I'm looking through the https://invent.kde.org/system/dolphin/-/blob/master/src/panels/terminal/terminalpanel.cpp) file and to me, it looks like some functions (e.g. TerminalPanel::slotMostLocalUrlResult) do not check if the terminal is working on something (TerminalPanel::hasProgramRunning()) before changing the directory, in which case they just SIGINT the job.

Myself, I don't have a development setup, so I cannot check if my hunch is correct an if sourcing .bashrc even raises the hasProgramRunning flag, but I hope that's it as it seems easy to fix.
Comment 45 Bharadwaj Raju 2022-02-04 06:29:20 UTC
*** Bug 407990 has been marked as a duplicate of this bug. ***
Comment 46 Bharadwaj Raju 2022-02-04 06:29:39 UTC
*** Bug 445774 has been marked as a duplicate of this bug. ***
Comment 47 Aaron Burnett 2022-05-11 22:01:38 UTC
Just thought I would add that I also see this problem in x2goclient.  ssh-agent is loaded (via keychain) in my ~/.zshrc, which Dolphin seems to fail to load.  "ssh-add -l" in the Dolphin terminal informs me that a connection to my authentication agent could not be opened (unless I source ~/.zshrc or restart the terminal, in which case it works fine).  Also, unsurprisingly, sftp does not access my private keys in Dolphin and I am prompted for a password.  Accessing the ssh-agent also fails for x2goclient, where I am prompted for passwords for hosts set up with key authentication.  I did not have this problem in Bash, or when using ssh directly via a terminal session that sources ~/.zshrc.  Perhaps the problem isn't with Dolphin?
Comment 48 Bug Janitor Service 2022-09-03 22:27:26 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/447
Comment 49 Méven Car 2022-10-02 07:21:17 UTC
Git commit 3656da18b094299c1f58245052af0f429857a6e4 by Méven Car, on behalf of John Brooks.
Committed on 02/10/2022 at 07:14.
Pushed by meven into branch 'master'.

terminal: Clear line using escapes instead of SIGINT

Sending SIGINT can be destructive, for example if we interrupt the
loading of the shell init files (e.g. .bashrc) and clobber history
preservation settings. Follow the example of Kate and send a Ctrl-E
Ctrl-U to clear the prompt instead.
Signed-off-by: John Brooks <john@fastquake.com>

M  +4    -12   src/panels/terminal/terminalpanel.cpp

https://invent.kde.org/system/dolphin/commit/3656da18b094299c1f58245052af0f429857a6e4
Comment 50 Katherine Agent 2022-11-20 21:47:16 UTC
(In reply to Luigi Keith from comment #43)
> You can fix this without making changes to souce code by simply making your
> .bashrc file as follows:
> 
> trap : SIGINT
> ## YOUR BASHRC CONTENT ##
> trap - SIGINT
> 
> This redirects any interrup signals to null- command during the sourcing
> phase and clears after sourcing has been done.
> 
> Why:
> - Dolphin opens with the tabs opened in the last session.
> - Dolphin parses all the paths of the tabs and starts calling directory
> changes to the terminal.
> - Dolphin has a failsafe feature when calling directory changes*[1]. It
> sends SIGINT to terminal process before changing directory.
> - This results in terminal (bash) interrupting .bashrc / .bash_profile
> parsing.
> 
> [1] panels/terminal/terminalpanel.cpp: TerminalPanel::sendCdToTerminal
>         // The TerminalV2 interface does not provide a way to delete the
>         // current line before sending a new input. This is mandatory,
>         // otherwise sending a 'cd x' to a existing 'rm -rf *' might
>         // result in data loss. As workaround SIGINT is sent.
>         const int processId = m_terminal->terminalProcessId();
>         if (processId > 0) {
>             kill(processId, SIGINT);
>         }

I had this issue emerge on my system with a fresh install of Arch Linux, and using zsh+oh-my-zsh. This workaround fixes the issue for me. Info about my system:

Operating System: Arch Linux
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Kernel Version: 6.0.8-arch1-1 (64-bit)
zsh version:  5.9-1
dolphin version: 22.08.3-1