preexec: work around upstream mangling of $HISTCONTROL
#1979
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a work around for the refusal of
bash-preexec
upstream to fix their mangling of user's$HISTCONTROL
. See upstream PR 119 for a complete, working patch which maintains their desired behavior, while alsö allowing the user to choose their own settings including fall-back code to emulate user intent, and fall-back code for close-enough when the user forces$HISTCONTROL
, and compatibility with Bash 3.2–5.x.Motivation and Context
This workaround is intended to avoid the need to patch upstream (see #1966). We could of course just patch upstream and carry the patch ourselves, but that would introduce additional friction for updates in the future.
Basically, this asks the
bash-preexec
lib to not run it's initializer when we load it, then we overwrite the problematic function, then we call the initializer ourselves. Result: no patch, no mangling.How Has This Been Tested?
Tested? Where we're going, we don't need testing. (@cornfeedhobo tested this on his system, and a version of this has been live in my main branch for months.)
Types of changes
Checklist:
clean_files.txt
and formatted it usinglint_clean_files.sh
.