<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>431044</bug_id>
          
          <creation_ts>2021-01-02 00:56:52 +0000</creation_ts>
          <short_desc>Terminal panel interrupts sourcing .bashrc at dolphin startup</short_desc>
          <delta_ts>2021-11-19 22:52:46 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>dolphin</product>
          <component>panels: terminal</component>
          <version>20.12.0</version>
          <rep_platform>Manjaro</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>279614</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Luigi Keith">b25e1938fe</reporter>
          <assigned_to name="Dolphin Bug Assignee">dolphin-bugs-null</assigned_to>
          <cc>dolphin-bugs-null</cc>
    
    <cc>nate</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1990095</commentid>
    <comment_count>0</comment_count>
    <who name="Luigi Keith">b25e1938fe</who>
    <bug_when>2021-01-02 00:56:52 +0000</bug_when>
    <thetext>SUMMARY
Terminal panel doesn&apos;t source ~/.bashrc when dolphin is reopened.
Returns normal with CTRL+D / exit and opening again (f4).

STEPS TO REPRODUCE
1. Open dolphin with terminal panel (f4).
2. Close dolphin.
3. Open dolphin. Terminal panel is restored.

OBSERVED RESULT
When dolphin is reopened the terminal panel is missing aliases and settings from the ~/.bashrc.

EXPECTED RESULT
Terminal panel has same properties as if opened manually.

SOFTWARE/OS VERSIONS
Qt Version: 5.15.2

ADDITIONAL INFORMATION
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

$BASH_ARGV has value &quot;/home/user/.bashrc&quot; instead of empty like when panel is working normally.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1991000</commentid>
    <comment_count>1</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2021-01-05 02:57:38 +0000</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 279614 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1991390</commentid>
    <comment_count>2</comment_count>
    <who name="Luigi Keith">b25e1938fe</who>
    <bug_when>2021-01-05 19:36:34 +0000</bug_when>
    <thetext>(In reply to Nate Graham from comment #1)
&gt; 
&gt; *** This bug has been marked as a duplicate of bug 279614 ***

Bug 279614 is specifically mentioned to occur during session restore which includes step to log out of the current session. This bug occurs even when not logged out of session but is probably caused by same code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2078920</commentid>
    <comment_count>3</comment_count>
    <who name="Luigi Keith">b25e1938fe</who>
    <bug_when>2021-11-19 22:52:46 +0000</bug_when>
    <thetext>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 &apos;cd x&apos; to a existing &apos;rm -rf *&apos; might
        // result in data loss. As workaround SIGINT is sent.
        const int processId = m_terminal-&gt;terminalProcessId();
        if (processId &gt; 0) {
            kill(processId, SIGINT);
        }</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>