Ticket #2830 (accepted defect)
Bash subshell history not written on exit
Reported by: | josh | Owned by: | slavazanko |
---|---|---|---|
Priority: | minor | Milestone: | Future Releases |
Component: | mc-core | Version: | master |
Keywords: | Cc: | info@… | |
Blocked By: | Blocking: | ||
Branch state: | on rework | Votes for changeset: |
Description
Since Bash 4.2, closing with any signal will not cause it to write the command history. This is intended, see:
http://www.mail-archive.com/bug-bash@gnu.org/msg08850.html
The consequence is that leaving MC via F10 will make a Bash subshell forget its history, whereas leaving MC via "exit" in the subshell will work as expected.
This is obviously not MC's fault, but still a regression and very annoying.
My suggestion is to change "exit_subshell()" to actually issue the "exit" command to the subshell.
Unfortunately, I'm not familiar enough with MC's internals to assess if that suggestion is viable.
Attachments
Change History
comment:1 Changed 12 years ago by josh
I tested the patch attached; it works with MC 4.8.1.3 and Bash 4.2.8.
I'm not familiar with the other supported shells, so I just assumed that they all know the "exit" command.
comment:2 Changed 12 years ago by slavazanko
- Status changed from new to accepted
- Owner set to slavazanko
comment:3 Changed 12 years ago by slavazanko
- Branch state changed from no branch to on review
Created branch 2830_subshell_history
Review, please
comment:4 Changed 12 years ago by ossi
you need to grant the shell some time (a second?) to actually exit as well ...
also, done in this naive way, it only aggravates the "oops, there way already something in the input buffer" problem.
first, you need to finally fix the shell state detection the _right_ way (we can brainstorm in the other ticket if you need help with that).
then, if you detect that the shell is not ready, send it a sigint (ctrl-c) (and again wait a second) before sending the exit command.
comment:5 Changed 12 years ago by slavazanko
- Branch state changed from on review to on rework
first, you need to finally fix the shell state detection the _right_ way
Yes, shell state should be recognized as well. And as solution I had one idea: joint usage of the subshell prompt and the prompt under mc's panels. But for this we should catch any key presses in subshell (or in mc) and correctly interpret in mc (or in subshell). But some hotkeys have different sense for all the subshells, also mc have own thinks about hotkeys (may be redefined in mc.keymap file).
(we can brainstorm in the other ticket if you need help with that).
This would be very cool, need help from any person in this point.