Skip to content

Comments

Use a function substitution in $PS0 for preexec in Bash >= 5.3#166

Open
akinomyoga wants to merge 4 commits intorcaloras:masterfrom
akinomyoga:PS0-funsub
Open

Use a function substitution in $PS0 for preexec in Bash >= 5.3#166
akinomyoga wants to merge 4 commits intorcaloras:masterfrom
akinomyoga:PS0-funsub

Conversation

@akinomyoga
Copy link
Contributor

@akinomyoga akinomyoga commented Jan 9, 2025

This implements the approach to preexec using a function substitution in PS0 mentioned in #28 (comment). This should solve the issues #164 (subshells), #6 (function definitions), #158 (comments), #147 (custom HISTIGNORE/HISTCONTROL) in Bash 5.3 (which is now under the beta testing). It should be noted that this doesn't change the situation in Bash <= 5.2.

edit: The issue with HISTIGNORE and HISTCONTROL isn't solved by this PR.

@akinomyoga akinomyoga changed the title Use $PS0 and function substitution in Bash >= 5.3 Use a function substitution in $PS0 for preexec in Bash >= 5.3 Jan 9, 2025
* Do not prefix local varnames with underscores
* Make "__bp_invoke_pre{cmd,exec}_functions" return the last non-zero exit status
* Test "__bp_invoke_pre{cmd,exec}_functions"
@hpfr
Copy link

hpfr commented Jan 4, 2026

Bash 5.3 has been out for about six months, and sourcing bash-preexec from this PR works for me with atuin. @akinomyoga anything to add other than a rebase? @rcaloras would you be able to take a look?

@akinomyoga
Copy link
Contributor Author

@akinomyoga anything to add other than a rebase?

No.

@hpfr
Copy link

hpfr commented Jan 8, 2026

On reflection, @rcaloras what do you think about bringing on @akinomyoga as a collaborator with merge permissions (assuming he is amenable to it, of course)? Based on his recent work in bash-preexec, atuin’s Bash integration, ble.sh, bash-completion, and oils (a promising Bash-compatible shell), he seems like an excellent candidate.

No affiliation, just an appreciative user!

@akinomyoga
Copy link
Contributor Author

If @rcaloras is comfortable with it, I can be a collaborator, but I'm not sure if that actually changes the situation. It depends on the goal of this project and what kind of role and discretion in the project would be given to me as a collaborator. Even if I become a collaborator, @rcaloras makes the final decisions on the design and the direction of the project. If the project goal is to show the simplest implementation compromising stability and robustness (as guessed from past replies), any changes that increase the number of lines of code would never be adopted, even if it solves real problems.

@hpfr
Copy link

hpfr commented Jan 8, 2026

If the project goal is to show the simplest implementation compromising stability and robustness (as guessed from past replies), any changes that increase the number of lines of code would never be adopted, even if it solves real problems.

Ah, thanks for the context. Based on the tastes I’ve observed in your comments and commit messages here and elsewhere, if you were to maintain a fork, I’d certainly adopt it. I’m already using the version from this branch, but I don’t think there’s one branch integrating the various other patches you and others have submitted. It would be great if Ryan is open to collaborate, since forks have low visibility and have to build reputation mostly from scratch. But that’s how FOSS works sometimes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants