Skip to content
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

Buncha "have: command not found" errors in bash #10

Open
2 tasks
apjanke opened this issue Jan 17, 2024 · 5 comments
Open
2 tasks

Buncha "have: command not found" errors in bash #10

apjanke opened this issue Jan 17, 2024 · 5 comments
Assignees
Labels

Comments

@apjanke
Copy link
Owner

apjanke commented Jan 17, 2024

For the last week or so, when I fire up bash from inside a zsh session inside a Mac terminal (iTerm2) using these dotfiles, I get a bunch of error messages like "bash: have: command not found".

I don't know what would be calling have; I don't seem to be doing so inside my bashy dotfiles here.

Maybe it's some bash completion thing? https://stackoverflow.com/questions/12874920/have-keyword-for-bash-completion

Symptoms

🎊  janke@ (base) ~ 
  bash
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: /usr/local/etc/bash_completion.d/cvs: line 20: syntax error near unexpected token `('
bash: /usr/local/etc/bash_completion.d/cvs: line 20: `        COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )'
bash: /usr/local/etc/bash_completion.d/cvs: line 21: syntax error near unexpected token `else'
bash: /usr/local/etc/bash_completion.d/cvs: line 21: `    else'
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: have: command not found
bash: /usr/local/etc/bash_completion.d/dvd+rw-tools: line 19: syntax error near unexpected token `('
bash: /usr/local/etc/bash_completion.d/dvd+rw-tools: line 19: `        /?(r)dev/*)'
bash: have: command not found
bash: have: command not found

No idea what's going on here. I don't see any have calls in my dotfiles.

This is on at least angharad, my macOS 14.2.1 iMac on Intel Mac.

TODO

  • Investigate interaction between MacPorts and Homebrew bash completion, and my own fussy "support both shells" user rc file arrangement.
  • Add notes to the doco about not mixing MacPorts and Homebrew, at least wrt bash completion and other configuration.
@apjanke
Copy link
Owner Author

apjanke commented Jan 17, 2024

Oh, yeah, this looks completion-related. I uninstalled bash from Homebrew and MacPorts on this box, and then re-installed bash-completion on both of them, and now the errors have changed and are saying more stuff about completion.

Maybe this is a problem with both MacPorts and Homebrew trying to control files in the main /etc dir?

image

@aredridel
Copy link

Almost certainly completion:

homebrew/etc/bash_completion.d on  master (302e83e9a)
:; grep have * | more
grep: helpers: Is a directory
abook:have abook &&
ant:have ant &&
ant:have complete-ant-cmd.pl && \
apache2ctl:have apache2ctl && {
apt:have apt-get &&
apt:have apt-cache &&
apt-build:have apt-build &&
aptitude:have aptitude && {
aptitude:have grep-status && {

etc

@aredridel
Copy link

have is defined by homebrew/etc/bash-completion (not .d):

have()
{
    unset -v have
    # Completions for system administrator commands are installed as well in
    # case completion is attempted via `sudo command ...'.
    PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null &&
    have="yes"
}

@aredridel
Copy link

Certainly mixing macports and homebrew is weird, and might introduce conflicts since neither is reconciling with the other, but I don't know of any specific conflict offhand.

@apjanke
Copy link
Owner Author

apjanke commented Jan 17, 2024

Ah, good catch. I did a brew rm bash-completion and the errors went away.

I've got an oddball system here, and it's probably due to that: up until recently, I was a macOS 10.14 Mojave holdout, and thinking about migrationg Octave.app to MacPorts, so running MacPorts for the last couple years, and then recently added Homebrew back in. And set up these dotfiles to conditionally load them, but seems like you can't easily fully conditionalize loading in MacPorts. Or, more likely, I'm just doing it wrong.

I think I'll prolly just uninstall MacPorts here, and stick to one or the other of it or Homebrew on each machine.

Thanks, @aredridel!

@apjanke apjanke self-assigned this Jan 17, 2024
@apjanke apjanke added the bug label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants