Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 903861 - app-shells/bash: add some $HISTCONTROL setting for interactive shells by default
Summary: app-shells/bash: add some $HISTCONTROL setting for interactive shells by default
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-05 08:59 UTC by Christian Bricart
Modified: 2024-05-10 18:22 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Bricart 2023-04-05 08:59:47 UTC
suggestion:
It would be really nice to have some HISTCONTROL setting system-wide by default.

i.e. I really miss at least a HISTCONTROL=ignorespace to be set (system-wide).

rationale: 
at least I made it a habbit to always prefix commands like »reboot«, »poweroff«, … (ymmv) with a space, to have them not end up in the history and unintentionally call them again by sticky fingers

of course, everyone is able to set that in one's own ~/.bashrc or even drop some file in /etc/bash/bashrc.d/ by their system provisioning solution, but that might turn out to be very cumbersome to most users.

however, I think this would be a really nice addition to system default's /etc/bash/bashrc (already being delivered by app-shells/bash from its $FILESDIR) wrt default user experience.


Reproducible: Always
Comment 1 Yuri 2023-09-01 19:48:29 UTC
Having at least the 'ignorespace' set would be great since space is customary used for prefixing sensitive commands (e.g. passwords as a part of a command).
Comment 2 RumpletonBongworth 2024-05-10 18:07:24 UTC
It's such a pity that HISTIGNORE does not treat its patterns as extended globs unless the extglob shell option is set. Were it to do so, the issue described by Christian could be dealt with more effectively - and less invasively - by setting something like:

HISTIGNORE='*([[:blank:]])@(halt|poweroff|reboot|shutdown|systemctl+([[:blank:]])reboot)?([[:blank:]]*)'
Comment 3 RumpletonBongworth 2024-05-10 18:22:44 UTC
Or, rather:

HISTIGNORE='*([[:blank:]])@(halt|poweroff|reboot|shutdown|systemctl+([[:blank:]])@(halt|poweroff|reboot|shutdown))?([[:blank:]]*)'

I may try submitting a request for HISTIGNORE to always act as if extglob were enabled for 5.3, even though I generally expect for Ramey to reject anything I suggest.