Bug 328068

Summary: Automatic sending chdir to embedded terminal may lead to tragic consequences if some command is already typed.
Product: [Applications] krusader Reporter: Dmitry Alexandrov <dag>
Component: generalAssignee: Krusader Bugs Distribution List <krusader-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: alex.bikadorov, krusader-bugs-null, psbkde
Priority: NOR    
Version First Reported In: 2.4.0-beta3 "Single Step"   
Target Milestone: ---   
Platform: unspecified   
OS: All   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Dmitry Alexandrov 2013-11-25 16:21:59 UTC
On chage working directory in panel Krusader sends cd to terminal emulator regardless of whether command line empty or not. So if you will leave there some unfinished command, ‘cd '/path/to/dir/'’ will be blindly appended to it and result will be executed.

Reproducible: Always

Steps to Reproduce:
1. Make sure that ‘Terminal Emulator sends Chdir on panel change’ option is enabled.
2. Open embedded terminal emulator.
3. Type ‘rm -rf ’.
4. Switch to panel, press ~ (shortcut for open home dir).
5. $ rm -rf cd '/home/username/' have been executed.
Actual Results:  
Oops!

Expected Results:  
At least Krusader should send ^U before sending cd '...' to terminal.
Comment 1 Alex Bikadorov 2017-01-27 18:51:19 UTC
Git commit 2aaba3ea1881e30b65b4dce8a758da1a72c011f9 by Alexander Bikadorov.
Committed on 27/01/2017 at 18:48.
Pushed by abikadorov into branch 'master'.

FIXED: [ 328068 ] Send SIGINT before own input command to embedded terminal

To avoid unwanted behaviour by line concatenation.

M  +11   -2    krusader/GUI/terminaldock.cpp

https://commits.kde.org/krusader/2aaba3ea1881e30b65b4dce8a758da1a72c011f9
Comment 2 Alex Bikadorov 2017-01-27 18:52:43 UTC
"^C" (SIGINT) is send before command (not only chdir but also user action commands).
Comment 3 Wladimir Palant 2017-02-01 10:19:56 UTC
I filed bug 375830 on a regression that this caused.