maemo.org Bugzilla – Bug 4174
shell history file is overwritten after every command
Last modified: 2009-10-22 07:57:42 UTC
You need to
before you can comment on or make changes to this bug.
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.
History file is only updated when shell exits.
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).
EXTRA SOFTWARE INSTALLED:
There's no way to disable history saving as in most shells by setting an
environment variable, and unsetting HISTFILE doesn't change anything.
5.0-alpha code doesn't look better. IMHO it's probably worth building without
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:18.104.22.168)
Gecko/2009020911 Ubuntu/8.10 (intrepid) Firefox/3.0.6
Comparing with upstream the only relevant patch that *might* have fixed this is
, while Fremantle still ships version 1.10.
If you find some time to take a quick look I'd appreciate it. :)
If that patch does not cover the issue I will forward this upstream.
(As far as I know, Nokia does not change the Busybox code so apart from
configuration issues it's always an upstream problem.)
(In reply to comment #1)
> Comparing with upstream the only relevant patch that *might* have fixed this is
This only deals with the in-memory history. The logic of when to save/load
still seems the same currently in both trunk (r23938) and the
busybox_1_13_stable branch (r24175).
> (As far as I know, Nokia does not change the Busybox code so apart from
> configuration issues it's always an upstream problem.)
Well, there's https://garage.maemo.org/projects/busybox4maemo now :-)
Thanks for the investigation!
Upstreamed as https://bugs.busybox.net/show_bug.cgi?id=149 .
Patch available in the upstream bug. Testing welcome.
Both patches attached to https://bugs.busybox.net/show_bug.cgi?id=185 deal with
the load_history issue (bug 4175), but history is still saved after each
POSIX/SUS are vague as usual on the subject, but IMHO ash should just load the
history once at startup and save it once at exit like most (all?) *nix shells
do. I might have a stab at this myself.
Created an attachment (id=1145) [details]
Patch for Diablo bb ash to load/save history only at start/exit time
While looking at this I came across another related bug where child shells also
overwrite the history file when they exit. So for example:
$ echo foo | read bar
would cause the history to be written three times in total.
Created an attachment (id=1146) [details]
same for Fremantle
Created an attachment (id=1147) [details]
same for current upstream
Turo, can you handle this directly here, or is an internal ticket required?
Patch available (comment 7).
------- Comment #6 From Denys Vlasenko 2009-03-26 13:18:56 UTC -------
Those patches are not safe wrt concurrent writes.
Try running two ash shells and give commands in each. Check history file, only
commands from last shell are there.
Denys is right, this is an issue when .ash_history is < MAX_HISTORY lines
Created an attachment (id=1162) [details]
The patch that was actually used for fixing this in Fremantle.
This has been fixed for Fremantle.
Oops, sorry for missing the hi initialisation (that's what you get for starting
at 1.13 and working backwards).
This is good enough for me (and also closes bug 4175). FYI there is an updated
patch awaiting comments in the upstream bug that takes care of the feedback in
comment 10, but I probably need to redo it for trunk (1.14.0.svn) where bug
4175 is fixed but this one is still present.
Setting Target Milestone to Fremantle SDK beta.
Marking patches of interest to Diablo (Maemo4) community updates, please excuse