[PATCH] add support for delayed history saving
Dennis Groenen
tj.groenen at gmail.com
Thu Aug 18 13:12:57 UTC 2011
This mail is a follow up to "[PATCH] ash: add support for history buffer"
On 08/09/2011 05:05 AM, Denys Vlasenko wrote:
> All you need is to create a CONFIG_ option which disables
> "save history to disk after every command" behavior in remember_in_history()
> function, makes save_history() non-static and calls it on shell exit
> in both ash and hush.
>
Pardon the late reply, I was outside the country last week. I gave what
you said a shot. Attached is the resulting patch that implements bash
like history saving in BusyBox.
All introduced code resides behind the new
FEATURE_EDITING_DELAYEDHISTORY config option. When a shell gets closed,
its history will get appended to its respective history file. This is
modeled after how bash handles (parallel) shells with regards to shell
history. There are no signs of history contamination when using parallel
shells.
There is, however, one (major) blocker with my patch. For some reason,
both the conditions "G.line_input_state->flags & SAVE_HISTORY" and
"G.line_input_state->hist_file" are true in hush when hush is not being
ran as an interactive shell (e.g. hush -c "echo hello"). Saving shell
history upon shell exit then will of course cause hush to segfault. Is
there a bug in hush causing those conditions to be true, or am I
overlooking something (in hush_exit())? This problem does not occur in
ash, which shares most of its history handling code with hush. Any input
on this is highly appreciated.
--Dennis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-add-support-for-delayed-history-saving.patch
Type: text/x-patch
Size: 4595 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20110818/4c2253be/attachment.bin>
More information about the busybox
mailing list