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 1794884

Summary: HISTTIMEFORMAT causes Segmentation fault under certain conditions
Product: Red Hat Enterprise Linux 8 Reporter: Need Real Name <christopher>
Component: bashAssignee: Siteshwar Vashisht <svashisht>
Status: CLOSED ERRATA QA Contact: Karel Volný <kvolny>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.4CC: kdudka
Target Milestone: rcKeywords: Reopened, Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: bash-4.4.20-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 20:03:01 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 Need Real Name 2020-01-25 02:25:42 UTC
Description of problem:

Enabling HISTTIMEFORMAT causes Segmentation fault (core dumped) if earlier history happens to contain certain data


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

4.3.30

How reproducible:

always

Steps to Reproduce:

1. Type the following nonsence line in bash
#1533478054739861000    # Dropped connection peer_ipc_nbsock_id 36

2. (the above will store that line in the .bash_history file when you log out)

3. Log out, log back in, enable HISTTIMEFORMAT="%F %T " (e.g. in /etc/profile)

4. run the "history" command.

Actual results:

[root@hpz ~]# history >out
Segmentation fault (core dumped)
[cnd@hpz ~]$ 

Expected results:

no core dump

Additional info:

Comment 1 Need Real Name 2020-01-25 02:28:36 UTC
note that you need to start this exercise *without* the HISTTIMEFORMAT already in use.

(If there are already valid times before the malformed data, I didn't see the same core dump)

Comment 4 RHEL Program Management 2021-07-25 07:30:13 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 5 Kamil Dudka 2021-07-26 07:17:06 UTC
I am able to reproduce it:

[root@ci-vm-10-0-138-227 ~]# rpm -q bash
bash-4.4.20-1.el8_4.x86_64

[root@ci-vm-10-0-138-227 ~]# printf '#1533478054739861000\n:\n' > .bash_history
[root@ci-vm-10-0-138-227 ~]# bash -l
[root@ci-vm-10-0-138-227 ~]# HISTTIMEFORMAT=%F history
Segmentation fault (core dumped)


It seems that el9 bash validates the timestamp properly though:

[root@ci-vm-10-0-138-137 ~]# rpm -q bash
bash-5.1.0-3.el9.x86_64

[root@ci-vm-10-0-138-137 ~]# printf '#1533478054739861000\n:\n' > .bash_history
[root@ci-vm-10-0-138-137 ~]# bash -l
[root@ci-vm-10-0-138-137 ~]# HISTTIMEFORMAT=%F history
    1  1533478054739861000: invalid timestamp:
    2  2021-07-26HISTTIMEFORMAT=%F history

Comment 17 Karel Volný 2021-08-29 21:17:21 UTC
# HISTTIMEFORMAT=%F history
    1  1533478054739861000: invalid timestamp:blah
    2  2021-08-29history
    3  2021-08-29HISTTIMEFORMAT=%F history
# rpm -q bash
bash-5.1.8-2.el9.x86_64

Comment 19 errata-xmlrpc 2021-11-09 20:03:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (bash bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4495