On Tue, Jul 15, 2025 at 7:23 AM Cristian Le via devel <devel@lists.fedoraproject.org> wrote: > During the review of bash-preexec [1] we came up on the issue that > according to the documentation, this package would be in conflict with > any other bash script that use the variable `PROMPT_COMMAND` or `DEBUG` > > > # Note: This module requires two Bash features which you must not > > otherwise be > > # using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. If you > > override > > # either of these after bash-preexec has been installed it will most > > likely break. > > But how do we enforce this incompatibility? From a talk at last year's > devconf [2], I've learned that you can add a Provides+Conflicts with the > same name which would disallow other packages with the same Provides to > be installed. I am considering using this mechanism. > > My proposal here is to define `Provides: bash(PROMPT_COMMAND)` for this > package, and hopefully other packages that use it and would probably > have a similar restriction. What do yall think? > > [1]: https://bugzilla.redhat.com/show_bug.cgi?id=2297308 > [2]: https://www.youtube.com/watch?v=3hPpKJMyD08
These days PROMPT_COMMAND is an array. You can add to it, rather than override it. For example, I have a file named ~/.bashrc.d/git with these contents: # Compute the current git branch git_prompt_command() { ref=$(/usr/bin/git rev-parse --abbrev-ref HEAD 2> /dev/null) git_branch=${ref:+:$ref} } export PROMPT_COMMAND+=(git_prompt_command) export PROMPT_END='${git_branch@P}' The git_prompt_command is added to the existing contents of PROMPT_COMMAND, so I get to keep all of the default behavior, plus see what git branch I'm on. That doesn't help with the DEBUG trap, of course. -- Jerry James http://www.jamezone.org/ -- _______________________________________________ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue