-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible regresion of issue 771 #842
Comments
Sorry about being slow on the uptake here. I'm eyeing #799 as a possible culprit here. I'd suspect that the cuplrit is a command which appends to PROMPT_COMMAND without checking to see if there's already a semicolon on the end. Could you share the output of |
Hi, no worries. My current
The components are:
|
Huh, so I guess I'm wrong. Can you post the exact error message you get? Does it also occur on line 8 with ``(_z --add "$(command pwd -P 2>/dev/null)" 2>/dev/null &)`, or is there a different message that gets displayed? |
The error:
The
|
Damned if we do, damned if we don't. (Thanks for telling me where the commands come from by the way--that ended up being very helpful). This is caused by #799, which looks like it was intended to avoid this kind of problem in the first place. (See the discussion on #784 for details). It seems that there's no solid convention for whether you throw a semicolon on the end or not. @InNoobWeTrust Should we consider this a bug on our end or should we file something against bash-it? If it's a bug, it probably in the |
My personal opinion is that one who mess with PROMPT_COMMAND should do proper check, so bash-it should be aware this kind of problem, like direnv and pyenv did (just my hypothesis without actually looking at the code, but they never break my system)... BUT, there is still hope, we may fix this ourselves with a little trick!
Practically, instead of just terminating ours, we can pull the trigger and release our alien This can create debate and I haven't checked if it complies to POSIX but it works for bash, at least on Termux (on Android). I can't guarantee that this is bug-free What is your opinion, @chipbuster? Do we have enough courage to try this or we prefer being safe and file a bug report to bash-it? |
@InNoobWeTrust My general feel is to prefer straightforward methods over clever hacks. We don't even have to formally file a bug report (yet), we can just ask what their preferred method for handling this is. If it turns out that they don't have a workaround and refuse to fix this, we can definitely look into
We haven't seen breakages, but this isn't a 100% guarantee that they won't, since those tend to be loaded earlier in the Also, Happy New Year! 🎆 |
Forgot to say, we can suggest them to try our current method in their code. Since the situation is the same with us. |
Until this issue be properly fixed, I applied this simple workaround: Adding this at the end of my PROMPT_COMMAND=${PROMPT_COMMAND/;;/;} |
Continue digging google for similar issues today, I found out that we can instead use Ref: Bug 704960 - /etc/profile.d/vte.sh overwrites PROMPT_COMMAND For bash/zsh, PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}'starship_precmd'$'\n' Midnight commander also uses this approach in their repo Test on Debian ❯ echo -e "$PROMPT_COMMAND"
starship_precmd;_pyenv_virtualenv_hook;
❯ PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND}$'\n'}'date'$'\n'
Thu 30 Jan 2020 03:53:22 PM +07
❯ echo -e "$PROMPT_COMMAND"
starship_precmd;_pyenv_virtualenv_hook;
date
Thu 30 Jan 2020 03:53:25 PM +07
❯ PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND}$'\n'}'echo hello'$'\n'
Thu 30 Jan 2020 03:53:31 PM +07
hello
❯ echo -e "$PROMPT_COMMAND"
starship_precmd;_pyenv_virtualenv_hook;
date
echo hello
Thu 30 Jan 2020 03:53:33 PM +07
hello
How do you guys think about this? If this is good enough, I'm going to make a pull request. 😉 |
LGTM |
Problem discussion continued (and eventually resolved) on #890 |
Bug Report
Current Behavior
Same as described in issue #771
Expected Behavior
Same as described in issue #771
Additional context/Screenshots
No error with version 0.32.2, with other newests versions, the issue occurs.
Environment
GNU bash, version 5.0.11(1)-release (x86_64-pc-linux-gnu)
Relevant Shell Configuration
https://github.com/edubxb/dotfiles/blob/master/.bashrc
Starship Configuration
https://github.com/edubxb/dotfiles/blob/master/.config/starship.toml
The text was updated successfully, but these errors were encountered: