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

Installing bash completion requires root privileges #2295

Closed
mathieucaroff opened this issue Apr 12, 2020 · 3 comments · Fixed by #5879
Closed

Installing bash completion requires root privileges #2295

mathieucaroff opened this issue Apr 12, 2020 · 3 comments · Fixed by #5879
Labels
area/docs Documentation issues/improvements

Comments

@mathieucaroff
Copy link

mathieucaroff commented Apr 12, 2020

In README.md, enabling tab completion for bash requires root privileges. This is inconsistent with (non-hombrew) fish and zsh completion definitions.

Related issue

Bash completion permission denied (#1017)

Note: The solution to the above issue is to use tee:

poetry completions bash | sudo tee /etc/bash_completion.d/poetry.bash-completion

Looking for a solution

Asking google yields this serverfault page: Standard place for user defined bash_completion.d scripts

The bash_completion tool actually sources ~/.bash_completion file see their FAQ "Where should I install my own local completions?". I thus believe the command for bash completion in README.md should be

poetry completions bash >> ~/.bash_completion

instead of

poetry completions bash > /etc/bash_completion.d/poetry.bash-completion

.

@mathieucaroff mathieucaroff added the kind/bug Something isn't working as expected label Apr 12, 2020
@dlech
Copy link

dlech commented Oct 23, 2020

My solution was to add this to my ~/.bashrc. This way I don't have to remember to update completions if I update poetry.

. <(poetry completions bash)

@finswimmer finswimmer added area/docs Documentation issues/improvements and removed kind/bug Something isn't working as expected labels Oct 29, 2020
@finswimmer
Copy link
Member

It would be a good idea to show it in the docs, how to add this to the users home folder. Just like for the other shells.

Happy to review a PR for this :)

fin swimmer

dlech added a commit to dlech/poetry that referenced this issue Feb 5, 2021
This changes the recommendation for bash completions to install in the user's home directory instead of the global `/etc` which would require root access.

The expression is exactly how bash completions looks for the directory. Comes from: https://github.com/scop/bash-completion/blob/9e98e2558c0625340013b123880ebb6bedc0d1b3/bash_completion#L2262

Also a section is added about how to dynamically add the completions instead of creating a static file and describes the pros and cons of doing it that way instead.

Fixes python-poetry#2295
Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/docs Documentation issues/improvements
Projects
None yet
3 participants