persistent history file truncation can corrupt it
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mksh |
Fix Released
|
Low
|
Unassigned |
Bug Description
The comment in histrap.
15:15⎜«ft:#grml» mira|AO: I've got an mksh, which uses 166750xxxx (I don't rememer where it started
⎜ exactly) as the history event number. What's not with that?
15:30⎜«ft:#grml» mira|AO: Yes, I'm setting HISTFILE.
15:31⎜«ft:#grml» it's ~/.mksh_history for me, even.
15:31⎜<
15:32⎜«ft:#grml» mira|AO: I can't say. 1.5-2000 maybe.
15:32⎜«ft:#grml» mira|AO: lines
15:37⎜<
15:37⎜«ft:#grml» mira|AO: 500 (so, I guess the file was even shorter. ;-))
No idea on the huge source->line, but the corruption may very well have been from truncation.
166750xxxx can be 636407E0 to 63642EEF
63642E = "cd." in ASCII
636420 = "cd " would also have been possible.
This can have happened if the line number of the first entry after truncation, modulo 256, was 255.
Since persistent history is disabled by default, this has low impact but should nevertheless be fixed.
I’ve done what I can to this code without rewriting it. Needs to be tested now. ft says it works for him.