-
Notifications
You must be signed in to change notification settings - Fork 382
Set environment variables needed for bash, zsh completion in opam env #6812
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
base: master
Are you sure you want to change the base?
Set environment variables needed for bash, zsh completion in opam env #6812
Conversation
da44a84 to
4773962
Compare
4773962 to
18a99a3
Compare
18a99a3 to
95d0887
Compare
|
@kit-ty-kate thanks for asking, no I don't have an idea about this environment variable (and whether to prepend or append to it). |
|
I don't know much about it. For bash-completion I suspect it could add completion scripts from installed opam packages, and I think those can run arbitrary commands. Then again I guess packages can already install arbitrary binaries shadowing common binaries such as |
|
Even if you're sandboxing the build commands (so you can't be pwned by arbitrary badness hidden behind a |
Not to mention that arbitrary ocaml packages can actually set or extend theses variables themselves… |
Yes. If this is decided out of scope for the opam tool, possibly the next best option would be a conf-completion package in the opam repository which contains just these two variables as setenv fields. Then tools could depend on that to get their users environments correctly configured for autocomplete. That feels like a bit of a hack compared to doing it in code here. |
Would close #6427
This updates
opam envto setXDG_DATA_DIRS(from the XDG base directory specification) to include the current switch's share root, andFPATHto include%{share}%/zsh/site-functionswhen the shell is zshThe former works with
bash-completion, which looks in the XDG_DATA_DIRS entries forbash-completion/completionssub-directories, while the later sets up zsh's built-in completion mechanisms to look in this location.Questions for reviewers --
guess_shell_compatcall?