Summary: | The Dolphin shell panel (opened by F4) does not source .bashrc when opened by session restore | ||
---|---|---|---|
Product: | [Applications] dolphin | Reporter: | Goran Brannstrom <goranbr> |
Component: | panels: terminal | Assignee: | John Brooks <john> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | adaptee, adrian, aoudelet, b25e1938fe, belitsky.a, bugseforuns, dunkan.aidaho, ejbiow, futilite, genacid, joel.bourquard, john, kagent42, karl, karolbienkowski, katyaberezyaka, kde-bugs, kde, kishore96, Landgraf132, lilydjwg, loic.grobol, mail, maltejur, matthias, minhkhoimk88, mullein, nate, someuniquename, spamsuxx, yerimyah1 |
Priority: | NOR | ||
Version: | 20.12.2 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
See Also: | https://bugs.kde.org/show_bug.cgi?id=407990 | ||
Latest Commit: | https://invent.kde.org/system/dolphin/commit/3656da18b094299c1f58245052af0f429857a6e4 | Version Fixed In: | |
Sentry Crash Report: |
Description
Goran Brannstrom
2011-08-07 20:39:14 UTC
Sorry for the bad spelling of "Dolphin" and "$ aliases" :-) Can confirm the bug. I installed KDE 4.7.0 using http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu 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. 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. > 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. ** > 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. ** > (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? 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 (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. 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 FYI: Bug still remains in KDE 4.7.3. 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. 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) As far as i remember - this bug does not exist in KDE 4.6.x 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 . i am running KDE SC 4.8 and still can reproduce this problem I run KDE SC 4.8.1 at home and Dolphin still has this bug in this version. Resetting assignee to default as per bug #305719 Bug is gone for me in KDE 4.9.2 (at least I can't reproduce it anymore). Cheers, Bjoern 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 Please, Goran, try to provide a set of steps to reproduce the issue in 4.9.2. 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 Thanks for the updated information. I will try to reproduce and investigate. 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. 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. 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. 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? If nobody responds in the next two weeks, I'll assume that this bug is indeed fixed. (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 Hi! I can no longer reproduce this error. 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! 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. 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 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 i am also currently experiencing this issue too on distro : Manjaro Plasma version: 5.19.5 frameworks: 5.74.0 Qt 5.15.1. *** Bug 431044 has been marked as a duplicate of this bug. *** 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 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. This happens on openSUSE Tumbleweed, but somehow not on openSUSE Leap 15.2. 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 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. 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. 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'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. *** Bug 407990 has been marked as a duplicate of this bug. *** *** Bug 445774 has been marked as a duplicate of this bug. *** 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? A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/447 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 (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 |