Bug 267902

Summary: dolphin terminal improperly saves bash history
Product: [Applications] konsole Reporter: whatmeurgent <whatmeurgent>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED NOT A BUG    
Severity: normal CC: a.samirh78, adaptee, whatmeurgent
Priority: NOR    
Version: 2.6.1   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description whatmeurgent 2011-03-07 19:17:48 UTC
Version:           unspecified (using KDE 4.6.0) 
OS:                Linux

Dolphin seems to save the history of commands entered in its terminal panel (f4) to ~/.bash_history only upon closing of the entire dolphin application, not upon closing of the dolphin terminal panel.

In cases such as described below, this results in confusion and loss of history data.

Reproducible: Always

Steps to Reproduce:
01] Close all terminals/konsoles
02] Open dolphin
03] delete or rename .bash_history
04] Open a terminal in dolphin (F4)
05] type history to verify no history is present
06] enter a few commands
07] exit terminal (f4)
!!] at this point, .bash_history has NOT been updated, so ...
08] Open a console outside of dolphin (say alt-f2 konsole)
09] Perform some commands that you want recorded in .bash_history
10] close konsole; .bash_history for the session is recorded.
11] If you now now close dolphin, you will overwrite .bash_history,
    even though you closed the dolphin terminal before opening
    konsole.


Actual Results:  
1] History is not passed to a subsequent terminal session opened outside of dolphin.

2] History generated from another terminal session is lost even though no other terminal sessions were active at the time the terminal session was closed.

Expected Results:  
Dolphin terminal should save its history upon closing the terminal panel.
Comment 1 Jekyll Wu 2011-08-01 14:23:25 UTC
When and how to update ~/.bash_history is determined by bash, not by neither konsole nor dolphin. By default, bash will not update ~/.bash_history until it exits .

My recommendation is use 'shopt -s histappend' and put 'history -a; history -n' into $PROMPT_COMMAND, so that the ~/.bash_history is updated after each command, and the history is synchronized across all running bash.
Comment 2 Jekyll Wu 2011-08-04 13:46:31 UTC
You may have misundertood what F4 does in step 7. It only hides the terminal widget, instead of 'exiting terminal'. That bash is still running, so of course ~/.bash_history is not updated.

I will close this as INVALID .
Comment 3 whatmeurgent 2011-08-04 17:49:01 UTC
I object to your clsoing the bug - If I did misunderstand what F4 is doing, then it may need to be more clearly presented. Even once we agree what F4 is actually doing, there remains the questions SHOULD it be doing that.

Specifically, I have two objections. First, if it closes a console window in a windowing GUI, a user can be expected to think that it is closed.

Second, How then should a dolphin user actually close the console session, without having to close dolphin. Sounds a bit much to have to ask a user to close dolphin, and then re-enter dolphin, just to clean up a console executed under dolphin.


--- On Thu, 8/4/11, Jekyll Wu <adaptee@gmail.com> wrote:

> From: Jekyll Wu <adaptee@gmail.com>
> Subject: [Bug 267902] dolphin terminal improperly saves bash history
> To: whatmeurgent@yahoo.com
> Date: Thursday, August 4, 2011, 9:46 AM
> https://bugs.kde.org/show_bug.cgi?id=267902
> 
> 
> Jekyll Wu <adaptee@gmail.com>
> changed:
> 
>            What 
>   |Removed           
>          |Added
> ----------------------------------------------------------------------------
>          
>    Status|UNCONFIRMED     
>            |RESOLVED
>          Resolution| 
>                
>           |INVALID
> 
> 
> 
> 
> --- Comment #2 from Jekyll Wu <adaptee gmail
> com>  2011-08-04 13:46:31 ---
> You may have misundertood what F4 does in step 7. It only
> hides the terminal
> widget, instead of 'exiting terminal'. That bash is still
> running, so of course
> ~/.bash_history is not updated.
> 
> I will close this as INVALID .
> 
> -- 
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are a voter for the bug.
> You are on the CC list for the bug.
> You reported the bug.
>
Comment 4 whatmeurgent 2011-08-04 17:49:49 UTC
I object to your clsoing the bug - If I did misunderstand what F4 is doing, then it may need to be more clearly presented. Even once we agree what F4 is actually doing, there remains the questions SHOULD it be doing that.

Specifically, I have two objections. First, if it closes a console window in a windowing GUI, a user can be expected to think that it is closed.

Second, How then should a dolphin user actually close the console session, without having to close dolphin. Sounds a bit much to have to ask a user to close dolphin, and then re-enter dolphin, just to clean up a console executed under dolphin.


--- On Thu, 8/4/11, Jekyll Wu <adaptee@gmail.com> wrote:

> From: Jekyll Wu <adaptee@gmail.com>
> Subject: [Bug 267902] dolphin terminal improperly saves bash history
> To: whatmeurgent@yahoo.com
> Date: Thursday, August 4, 2011, 9:46 AM
> https://bugs.kde.org/show_bug.cgi?id=267902
> 
> 
> Jekyll Wu <adaptee@gmail.com>
> changed:
> 
>            What 
>   |Removed           
>          |Added
> ----------------------------------------------------------------------------
>          
>    Status|UNCONFIRMED     
>            |RESOLVED
>          Resolution| 
>                
>           |INVALID
> 
> 
> 
> 
> --- Comment #2 from Jekyll Wu <adaptee gmail
> com>  2011-08-04 13:46:31 ---
> You may have misundertood what F4 does in step 7. It only
> hides the terminal
> widget, instead of 'exiting terminal'. That bash is still
> running, so of course
> ~/.bash_history is not updated.
> 
> I will close this as INVALID .
> 
> -- 
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are a voter for the bug.
> You are on the CC list for the bug.
> You reported the bug.
>
Comment 5 Jekyll Wu 2011-08-04 18:35:14 UTC
(In reply to comment #4)
> 

About the first objection: I have no idea. Maybe you are right.

And the second objection: you can always tell that shell to exit by pressing
'Ctrl+D' as in any normal terminal emulator, without closing your dolphin.

Anyway, you (as reporter) should be able to reopen this report. But I think your
objection/confusion can only be solved in the dolphin side.