Your message dated Sat, 10 Aug 2024 23:10:33 +0200
with message-id <[email protected]>
and subject line Re: Bug#1001297: Bash history gets cleared due to lack of disk 
space - always keep some disk space reserved for bash_history file growth
has caused the Debian Bug report #1001297,
regarding Bash history gets cleared due to lack of disk space - always keep 
some disk space reserved for bash_history file growth
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 [email protected]
immediately.)


-- 
1001297: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1001297
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: bash
Version: 5.1.4

Rarely my bash_history gets cleared or at least loses most entries. I still 
don't know for certain what caused it but I had to do a shutdown due to a 
freeze in at least one case and think this / the loss of bash_history entries 
was caused by a lack of disk space. I asked about it here: 
https://unix.stackexchange.com/questions/669880/how-to-find-out-what-caused-a-deletion-of-bash-history-entries-during-a-specifi

Please somehow implement a reserve of disk space in Debian/bash that can only 
be used by bash_history file growth, and is always considered "taken up" disk 
space for anything else in Debian. For example 512 kB that are displayed as 
"used" disk space. This also requires proper appending of entries to this file 
- so that the file is not emptied, then other files take up the disk space and 
the rewritten after the needed disk space isn't available anymore. If the file 
somehow gets spammed and quickly maliciously grows in size this reserved disk 
space could also serve as a maximum file-size barrier that once reached does 
things like not writing new entries to the file and/or removes duplicate 
entries to free up space. It would be very useful to always have some reserved 
disk space for bash-history in general, not just due to bugs and alike.

--- End Message ---
--- Begin Message --- On Tue, 07 Dec 2021 23:02:38 +0000 mYnDstrEAm <[email protected]> wrote:> Rarely my bash_history gets cleared or at least loses most entries. I
still don't know for certain what caused it but I had to do a
shutdown due to a freeze in at least one case and think this / the
loss of bash_history entries was caused by a lack of disk space.

Bash version 5.2.21 overwrites the history file in a more careful way, so that its content is not lost when the history files is being written with a full disk.

This can be tested in the following way:

1. Copy a lot of lines into the clipboard

    $ cat /usr/share/dict/words | grep -E '^[a-z]+$' |
    head -n 10000 | xclip -selection clipboard

2. Set up a Debian VM with very little free space

$ debvm-create -- --customize-hook='echo tmpfs /root tmpfs defaults,mode=0755,size=10k >> "$1/etc/fstab"'

3. Log into the VM, fill up the space, try to updated .bash_history

    $ debvm-run
    # echo hello
    # history -a
    # cat .bash_history
    echo hello
    history -a
    # cat /dev/random > foo
    (paste lines into terminal and press enter)
    # history -a

4. Check that .bash_history is still there and not empty

    # head .bash_history -n 20
    echo hello
    history -a
    cat .bash_history
    cat /dev/random > foo
    history -a
    a
    aardvark
    aardvarks
    abaci
    aback
    abacus
    [...]

The file is truncated (most of the words have not been saved), but it still there and contains the older history entries.

--
Gioele Barabucci

--- End Message ---

Reply via email to