Forwarding from https://bugs.maemo.org/show_bug.cgi?id=4174 . VERSION: 1.10.2 STEPS TO REPRODUCE THE PROBLEM: 1. Establish a shell session (osso-xterm or ssh, user or root, doesn't matter). 2. Run "ls -l .ash_history" repeatedly. EXPECTED OUTCOME: History file is only updated when shell exits. ACTUAL OUTCOME: History file is re-written after every command entered (libbb/linedit.c:remember_in_history). This is causing unnecessary wear on the flash and wastes a bit of power. There are also side-effects with the way loading the history is handled (will post another bug shortly). REPRODUCIBILITY: Always. OTHER COMMENTS: There's no way to disable history saving as in most shells by setting an environment variable, and unsetting HISTFILE doesn't change anything. The logic of when to save/load still seems the same currently in both trunk (r23938) and the busybox_1_13_stable branch (r24175).
Created attachment 181 [details] Patch: make history saving/loading concurrent-safe Please try this patch. It makes the following changes: * all history writes always append (not overwrite) history files * they reload history if they detect that file length has changed since last write * they trim history file only when it grows 4 times longer thna MAXLINES * they do this atomically by creating new file and renaming it to old.
*** This bug has been marked as a duplicate of bug 185 ***