Bug 1871744 - 'history -a' doesn't belong in /etc/bashrc
Summary: 'history -a' doesn't belong in /etc/bashrc
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: setup
Version: 35
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: Martin Osvald πŸ›Ή
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-24 07:51 UTC by Rob Foehl
Modified: 2022-05-24 02:43 UTC (History)
5 users (show)

Fixed In Version: setup-2.13.10-1.fc36 setup-2.13.10-1.fc35
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-12 01:12:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Rob Foehl 2020-08-24 07:51:25 UTC
The 'history -a' in /etc/bashrc (introduced by commit 9ca3d30, apparently as suggested in bug 815810) doesn't appear to serve any purpose, as there shouldn't be any new history lines to append at that point in the shell's lifecycle.

In any case, this and any other history commands should not be run from startup scripts, as they may irreparably modify the history before any opportunity for the user to make changes to related settings.

(Found while trying to track down occasional loss/corruption of history on login, although likely not the cause.)

Comment 1 Pavel Zhukov 2020-11-26 08:08:28 UTC
Thank you for the report. 

Looks like this statement can be safely removed from the config. Other distributions either don't have one or have it disabled due to issues with NFS mounted /home or system recovery issues.

Comment 2 Ben Cotton 2021-02-09 16:25:12 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 3 Rob Foehl 2021-06-23 06:49:57 UTC
This still hasn't been removed in 34, nor have I found a better answer as to why this keeps happening:

β•Άβž€ set |grep ^HIST
HISTCONTROL=ignoreboth
HISTFILE=/home/rob/.bash_history
HISTFILESIZE=20000
HISTSIZE=20000
HISTTIMEFORMAT='%Y-%m-%d %H:%M:%S  '

β•Άβž€ history |tail -1
 1520  2021-06-23 02:45:25  history |tail -1

It was ~5600 lines a week ago, which is still far short of the 10000 that should be saved with that config.

Comment 4 Rob Foehl 2021-11-11 23:51:31 UTC
Still in 35.  What's holding up the removal of this one line?

Comment 5 Martin Osvald πŸ›Ή 2022-03-28 13:14:51 UTC
Please, could you answer the below questions?

1. If you remove 'history -a' from /etc/bashrc, does it solve the problem with losing cmd history for you?
2. Do you have steps/reproducer which would be showing 'history -a' in /etc/bashrc irreparably modifies the history?

Thanks!

Comment 6 Rob Foehl 2022-03-31 07:48:01 UTC
1. Unsure; I'd given up on the now years-long effort to get this single line removed, and moved all of my history files to non-default locations on systems that see heavy interactive use.  I haven't suffered further loss of history since making that change.

2. Not beyond what's in comment #3.  The problem is intermittent, occurring on the order of once every few weeks; possibly related to multiple simultaneous logins racing, or system reboots, or ...

Let's turn that latter question on its head, though: why is 'history -a' in /etc/bashrc at all?  What purpose could it possibly serve?  How is leaving it there not obviously incorrect?

The off-handed comment in bug 815810 that is apparently responsible was without explanation at the time, and hasn't been explained since.  This issue was also brought up years ago in bug 1193590, which seemed to generate decent consensus that it should be removed -- yet here we are, in another nearly two year old bug for a one line fix.  The level of effort required to undo this is not at all commensurate with that required to add it in the first place...

Comment 7 Martin Osvald πŸ›Ή 2022-05-07 14:53:17 UTC
Hi Rob,

Thank you a lot for the extensive background info. The fix will be in the upcoming release:

https://pagure.io/setup/c/713606713d65bf956ef4c98f4c82085bdfd9ba69?branch=master

Comment 8 Fedora Update System 2022-05-08 08:45:48 UTC
FEDORA-2022-13c2b1e6db has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-13c2b1e6db

Comment 9 Fedora Update System 2022-05-08 08:56:50 UTC
FEDORA-2022-d37f9b1e8b has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-d37f9b1e8b

Comment 10 Fedora Update System 2022-05-09 02:04:53 UTC
FEDORA-2022-d37f9b1e8b has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-d37f9b1e8b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-d37f9b1e8b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2022-05-09 02:54:58 UTC
FEDORA-2022-13c2b1e6db has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-13c2b1e6db`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-13c2b1e6db

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2022-05-12 01:12:54 UTC
FEDORA-2022-13c2b1e6db has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2022-05-24 02:43:43 UTC
FEDORA-2022-d37f9b1e8b has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.


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