Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2232155

Summary: There isn't an environment variable to limit the size of .sh_history with ksh
Product: Red Hat Enterprise Linux 8 Reporter: Dave Carmichael <dcarmich>
Component: kshAssignee: Vincent Mihalkovič <vmihalko>
Status: CLOSED NOTABUG QA Contact: Karel Volný <kvolny>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.8Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-16 15:17:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.