Git submodule fails with asdf error
jeff-hykin opened this issue ยท 19 comments
Steps to reproduce
XD: git submodule add https://github.com/jeff-hykin/beatle_interface
/usr/local/opt/asdf/lib/utils.sh: line 208: ASDF_GETTEXT.SH_VERSION: invalid variable name
asdf: No version set for command gettext.sh
you might want to add one of the following in your .tool-versions file:
python anaconda3-5.3.1
Expected behavior
Creating a git submodule should have nothing to do with asdf
Actual behavior
There's an asdf error and I'm unable to add git submodules
Environment
OS: MacOS Sierra 10.12.6
zsh version: 5.8 (x86_64-apple-darwin16.7.0)
asdf version: v0.7.6
Notes
why is asdf affecting git?
Uninstalling git with homebrew also does not solve the problem, I had to manually remove the $HOME/.asdf folder
What asdf plugins are you using?
Only python
Can you clarify what the output you posted above is?
And can you share the contents of the relevant .tool-versions
file?
The code that is failing is local version_env_var="ASDF_${upcase_name}_VERSION"
, and upcase_name
is the uppercase name of the plugin. So something on your system is fooling asdf into thinking GETTEXT.SH
is a plugin name. I don't know what that would be.
Hmm that is really strange then. I don't have a .tool-versions
file, there is no python in the entire file directory/repo that I'm in.
I found somewhat of a source of an issue. Reinstalling asdf with only python 3.8.2 lets the submodule work, however it begins failing again when I restore the old ~/.asdf
. After some debugging, I found that renaming ~/.asdf/shims/gettext.sh
to ~/.asdf/shims/gettext1.sh
for some reason prevents the error.
If asdf isn't hooking into git, then would it be something from python (probably anaconda) that is?
Upon reinstall it appears /usr/local/opt/asdf/lib/utils.sh
doesn't exist anymore, so the error message is this (note the restored ~/.asdf
didn't contain python 3.8.2):
asdf: No preset version installed for command gettext.sh
Please install the missing version by running one of the following:
asdf install python 3.8.2
or add one of the following in your .tool-versions file:
python anaconda3-5.3.1
That looks like a more reasonable error message. If you don't have a .tool-versions
file you have not specified a version (unless you used asdf shell
). I think you just need to run asdf local python anaconda3-5.3.1
for your project and I think it should work. If not try asdf reshim
.
Why is it activating at all though? How is the git command triggering asdf. As far as I know, git doesn't depend on python.
I don't really want a tools file with a python specification when python isn't even being used in the project, that doesn't make any sense to others who might be contributing. I'm not so much concerned about this small case as much as the implications of asdf breaking tools beyond whats in its shims.
No idea. Perhaps you have a git hook that is invoking an asdf shim? You will have to have a .tool-versions
file present on your system in order to use asdf. That is a requirement unless you want to manually set versions per shell session with asdf shell
.
No idea. Perhaps you have a git hook that is invoking an asdf shim?
I am certain that asdf itself is not meddling with Git. Git or another tool on your system is invoking an asdf shim.
Thanks, I'll do some research and see what I can find. I have a feeling it may have to do with git interacting with the asdf gettext shim
I ran into this issue and was able to resolve it by uninstalling anaconda3-2020.02
.
Here are the packages I had installed:
โฏ asdf list python
3.5.9
3.7.5
3.8.0
3.8.1
3.8.2
anaconda3-2020.02
And relevant line of .tool-versions
:
python 3.8.2 3.7.5 system
Same here, python anaconda3-2020.02
(not sure if other anaconda versions are affected, I've only installed that one) led to so many issues (like curl
stop working as which curl
led to asdf shims but there was no curl
inside...)
asdf uninstall python anaconda3-2020.02
solved all of the issues I had
also:
git bisect
also raises the same issue:
git bisect start
asdf: No version set for command gettext.sh
you might want to add one of the following in your .tool-versions file:
python anaconda3-2020.02
This problem appeared after installing anaconda3-2020.11 with asdf.
This is where problem is asdf-community/asdf-python#44
I also have gettext installed with homebrew and asdf shimed gettext breaks git for me. And look like I have similar problem with conflicting sqlite3.
@Stratus3D also seeing this issue when using the go plugin.
steps to reproduce:
asdf plugin add golang
asdf install golang latest
asdf global golang {version}
go version
/home/aaronreisman/.asdf/lib/utils.bash: line 234: ASDF_.._VERSION: invalid variable name
go version go1.16.6 linux/amd64
@lifeiscontent that appears to be a different issue, with a different plugin. Do you have any other plugins installed? If so, does that issue manifest with the others? Please also provide asdf info
output. I may close this issue as it seems like there are two issues here and the one with the python plugin doesn't appear to be caused by anything in asdf-core.
What I believe is happening, at least with the python one, is that git depends on gettext
and the bin of the python shim includes gettext which overrides the built-in gettext. Then when git tries to use asdf gettext and for some reason that breaks.
A potential solution, instead of adding all python bins into the current path, is to automatically wrap the python commands with an env var
python
#!/bin/bash
PATH="$SHIM_PATH:$PATH" python "$@"
pip
#!/bin/bash
PATH="$SHIM_PATH:$PATH" pip "$@"
Then those two commands could be added to the path instead of the entire python bin shim, which overrides gettext.sh and probably lots of other things .
I will close this issue soon because I don't think there is anything we can do to fix this in asdf core. This seems to be caused by a subset of plugins, python being the primary one. Unless someone identifies something in asdf core that is contributing to this project I suggest opening this same issue with maintainers of plugins that cause this issue.