Your message dated Mon, 1 Jul 2024 02:08:06 +0200
with message-id <c839156c-4fe0-421a-bb19-050682ed8...@svario.it>
and subject line Re: Bug#343976: Acknowledgement (History file is saved with 
incorrect size)
has caused the Debian Bug report #343976,
regarding History file is saved with incorrect size
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
343976: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=343976
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: bash
Version: 3.0-17

For quite a while now Ive noticed a bug in bash failing to save the history file correctly. I often find that a history of 500 lines simply isnt enough, so I have edited my .bashrc to set HISTSIZE and HISTFILESIZE to 5000. However this does not appear to make any difference, as the .bash_history file seems limited to 500 lines (actually, 505 lines at ~9k). Even checking that both environment variables are set to 5000.

Are there any instances in the bash source where these values are hard-coded, or even referenced? This bug has been present for well over a year, and finally annoyed me enough to report it.

I can help provide any further information necessary to help investigate this issue, but it seems to be 100% reproducable on several machines I have, running different versions of bash.

David Murn
David Murn


--- End Message ---
--- Begin Message ---
Version: 5.0-6

On Mon, 19 Dec 2005 16:37:22 +1100 "David Murn" <da...@incanberra.com.au> wrote:
Upon digging a little further (I really shouldve done this before submitting the first report), I have discovered what I think may be the problem. When I logout, bash saves the complete history (upto HISTSIZE lines) to the .bash_history file, however the problem occurs when bash starts up. It sets up its environment, setting HISTSIZE to 500, then reads in (at most) 500 lines from the .bash_history file. It then processes the .bashrc and HISTSIZE is set to 5000, but by then the history has already been truncated to the initial value of 500 lines.

There are a couple of solutions I can see to this..

1) Read in the .bash_history file upon startup, upto EOF. Once completed, set HISTSIZE to the number of lines read from the file. This has a problem that you are reading an unknown number of lines, so may need some upper limit set.

2) Process the .bashrc file before reading in the .bash_history file, so that if the user does wish to change these values, it is possible. This would seem to be the easiest option, however I have not looked too in-depth at how this could be accomplished.

Bash version 5.0-6 (but probably also already in version 4) correctly reads ~/.bashrc before reading ~/.bash_history.

Regards,

--
Gioele Barabucci

--- End Message ---

Reply via email to