Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 8458 - /etc/profile shouldn't set HISTFILESIZE
/etc/profile shouldn't set HISTFILESIZE
Product: Red Hat Linux
Classification: Retired
Component: setup (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Depends On:
  Show dependency treegraph
Reported: 2000-01-13 18:00 EST by James Ralston
Modified: 2014-03-16 22:12 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-01-13 18:37:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description James Ralston 2000-01-13 18:00:42 EST
In setup-2.0.5-1 (on i386 for certain, and probably on all architectures),
/etc/profile says:


...and then exports both variables.

The very act of setting HISTFILESIZE causes bash to run out and truncate
the history file.  The truncation occurs at the instant HISTFILESIZE is
set.  Therefore, attempting to set a higher value for HISTFILESIZE in one's

    export HISTSIZE=5000
    export HISTFILESIZE=5000

...is useless, because the history file has already been truncated by
/etc/profile before ~/.bash_profile is even sourced.

Fortunately, every version of bash I've ever seen has a feature that is
useful here: for interactive shells, after the sourcing of initialization
files has been completed, if HISTFILESIZE is not set, bash will
automatically initialize HISTFILESIZE to the value of HISTSIZE and perform
any required history file truncation.  (See the beginning of the
load_history() function in bashhist.c.)

Unfortunately, this behavior isn't documented, but its presence leads to an
elegant solution: in /etc/profile, set and export a default HISTSIZE, but
don't set HISTFILESIZE.  This allows users full freedom to set either
HISTSIZE or HISTFILESIZE in their ~/.bash_profile files.  If they don't
explicitly set HISTFILESIZE, it will be automatically set to whatever they
set HISTSIZE to; if they don't set HISTSIZE, then HISTFILESIZE will
automatically inherit the same value that /etc/profile sets for HISTSIZE.
Comment 1 Bill Nottingham 2000-01-13 18:37:59 EST
Fixed in CVS, will be fixed in setup-2.1.0 release.

Note You need to log in before you can comment on or make changes to this bug.