[1.20.0] histfile can get emptied when CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y

Denys Vlasenko vda.linux at googlemail.com
Thu Apr 26 09:20:05 UTC 2012


On Tue, Apr 24, 2012 at 10:40 PM, Dennis Groenen <tj.groenen at gmail.com> wrote:
> When CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is set to y, the histfile will get cleared if the total amount of history lines is less than MAX_HISTORY.
> Only if the histfile is not empty _and_ the amount of lines currently in memory are equal to or greater than MAX_HISTORY, history saving will work as expected with this feature enabled.
>
> Output from defconfig + CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y:
> [dennis at i7-820qm ~/busybox/a]$ echo "foo" > ~/.ash_history
> [dennis at i7-820qm ~/busybox/a]$ ./busybox ash
> ~/busybox/a $ echo "bar" > /dev/null
> ~/busybox/a $ exit
> [dennis at i7-820qm ~/busybox/a]$ cat ~/.ash_history
> [dennis at i7-820qm ~/busybox/a]$
>
> Attached is a patch that resolves this issue. Output with the patch applied and same config as above:
> [dennis at i7-820qm ~/busybox/b]$ echo "foo" > ~/.ash_history
> [dennis at i7-820qm ~/busybox/b]$ ./busybox ash
> ~/busybox/b $ echo "bar" > /dev/null
> ~/busybox/b $ exit
> [dennis at i7-820qm ~/busybox/b]$ cat ~/.ash_history
> foo
> echo "bar" > /dev/null
> exit
> [dennis at i7-820qm ~/busybox/b]$

Applied, thanks!
-- 
vda


More information about the busybox mailing list