Bug 2232155 - There isn't an environment variable to limit the size of .sh_history with ksh
Summary: There isn't an environment variable to limit the size of .sh_history with ksh
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: ksh
Version: 8.8
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Vincent Mihalkovič
QA Contact: Karel Volný
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-15 15:59 UTC by Dave Carmichael
Modified: 2023-08-17 13:53 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-08-16 15:17:15 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-165857 0 None None None 2023-08-15 16:01:41 UTC

Description Dave Carmichael 2023-08-15 15:59:25 UTC
Description of problem:

With ksh there is no HISTFILESIZE environment variable to limit the size of the history file per the man page. Is this the expected behavior? 

The customer must use logrotate or a cron job to prevent /home from filling up.

Version-Release number of selected component (if applicable):


How reproducible:

Easy


Steps to Reproduce:

1. Set shell to ksh
   usermod -s /bin/ksh dave

2. Set the HISTSIZE variable

     $ env|grep HIST
     HISTCONTROL=ignoredups
     HISTFILESIZE=15
     HISTSIZE=10

3. Run some commands and notice .sh_history continues to grow even though the lines displayed are limited to HISTSIZE setting.

$ history
81	exit
82	ls -l
83	ls -al
84	ls -l .sh_history
85	pwd
86	ls
87	pwd
88	ls -l .sh_history
89	env|grep HIST
90	history



Actual results:

The history file continues to grow.

$ ls -l .sh_history
-rw-------. 1 dave dave 724 Aug 15 11:43 .sh_history
$ pwd
/home/dave
$ ls
$ pwd
/home/dave
$ ls -l .sh_history
-rw-------. 1 dave dave 760 Aug 15 11:43 .sh_history


Expected results:

With bash the .sh_history file stops growing once HISTFILESIZE is reached.

$ ls -l .sh_history
-rw-------. 1 dave dave 888 Aug 15 11:48 .sh_history
[dave@purple ~]$ env|grep HIST
HISTCONTROL=ignoredups
HISTSIZE=10
HISTFILESIZE=12
[dave@purple ~]$ ls -l .sh_history
-rw-------. 1 dave dave 888 Aug 15 11:48 .sh_history

Comment 1 Vincent Mihalkovič 2023-08-16 15:17:15 UTC
Hello,

> With ksh there is no HISTFILESIZE environment variable to limit the size of the history file per the man page. Is this the expected behavior?
Yes, this is expected behavior. There is no remark of a `HISTFILESIZE` variable in the ksh manual pages.

I can report this to upstream as a feature request.


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