tj / tj/git-extras

make install fails for different install locations of `bash_completion`

Open
#237 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
18.1k
Forks
1.2k
Avg merge
5d 17h
Merged PRs (30d)
1

Description

Running on OS X, having installed bash_completion through Homebrew my completion directory is not /etc/bash_completion.d/.

Instead it is /usr/local/etc/bash_completion.d/, or more general: $(brew --prefix)/etc/bash_completion.d/

Running make install I get the following error:

... installing git-summary
... installing git-touch
... installing git-undo
... installing git-unlock
cp -f man/git-*.1 "/usr/local/share/man/man1"
mkdir: /etc/bash_completion.d: Permission denied
make: *** [install] Error 1

This is because /etc/ is owned by root, /etc/bash_completion.d/ does not exist (nor should it!) and it is trying to mkdir as my current user.

I suggest adding in a check that if the user has brew and if `$(brew --prefix)/etc/bash_completion.d/' exists that then that directory is used, rather than the current hardcoded default.

Would a pull request for this be welcome?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the install target invoked by make install and reproduce the failure on OS X with Homebrew's bash_completion location. Trace how the completion directory is selected, then verify that installation completes without a permission error when the completion files are under $(brew --prefix)/etc/bash_completion.d/.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, shell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.