asdf: bug: lib/utils.bash: line 234: ASDF_.._VERSION: invalid variable name

Describe the Bug

When I run neovim latest asdf reports an invalid variable name.

Steps to Reproduce

~
➜ nvim
/home/jesse/.asdf/lib/utils.bash: line 234: ASDF_.._VERSION: invalid variable name

Expected Behaviour

Neovim would start with no error notice in the terminal.

Actual Behaviour

I see this error message:

/home/jesse/.asdf/lib/utils.bash: line 234: ASDF_.._VERSION: invalid variable name

Environment

OS:
Linux jimmie 5.11.0-31-generic #33-Ubuntu SMP Wed Aug 11 13:19:04 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

SHELL:
fish, version 3.1.2

ASDF VERSION:
v0.8.1-a1ef92a

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/home/jesse/.asdf

ASDF INSTALLED PLUGINS:
deno                         https://github.com/asdf-community/asdf-deno.git
dotnet-core                  https://github.com/emersonsoares/asdf-dotnet-core.git
elixir                       https://github.com/asdf-vm/asdf-elixir.git
elm                          https://github.com/asdf-community/asdf-elm.git
erlang                       https://github.com/asdf-vm/asdf-erlang.git
haskell                      https://github.com/vic/asdf-haskell.git
lua                          https://github.com/Stratus3D/asdf-lua.git
neovim                       https://github.com/richin13/asdf-neovim.git
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git
postgres                     https://github.com/smashedtoatoms/asdf-postgres.git
python                       https://github.com/danhper/asdf-python.git
redis                        https://github.com/smashedtoatoms/asdf-redis.git
ruby                         https://github.com/asdf-vm/asdf-ruby.git
rust                         https://github.com/code-lever/asdf-rust.git
shfmt                        https://github.com/luizm/asdf-shfmt.git
yq                           https://github.com/sudermanjr/asdf-yq.git


### asdf plugins affected (if relevant)

It might be one of the later plugins I have installed. Plugins that might be affecting it:

* dotnet-core
* haskell
* neovim (naturally)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 26 (12 by maintainers)

Commits related to this issue

Most upvoted comments

The problem (at least on my side) is that running asdf reshim sometimes (god knows why) adds a ghost plugin candidate .. to the shim file, and because how the reshim script works, it’s never removed.

Print from my npm shim file for example:

image

See those asdf-plugin: .., those are the ones that are causing the issue.

The workaround for me is deleting the shim script and then reshimming:

rm "$ASDF_DIR/shims/npm" 
asdf reshim node

You might as well delete all others shims and reshim them all over again:

rm "$ASDF_DIR"/shims/*
asdf reshim

I don’t know if this issue exists because I kept messing with symlinks in the plugins dir, or because some bug in the past created them.

I think the solution should be cleaning these ghost plugins after reshims, or making a specific command for pruning/cleaning the shims directory

@augustobmoura thanks for the comment. It appears we’ve got a bug somewhere in our reshim logic as I just encountered issue myself (and I’m not using any symlinks). It does appear .. is getting added somehow. Perhaps from the output of ls or a similar command.

Update: asdf-vm is not the root cause for my case; it’s actually a container virtualization bug in Alpine Linux 3.14 and has nothing to do with extra/missing files under ~/.asdf. Upgrading to a newer Docker version, which contains a newer runc, fixed the issue in my case.

It does seem like ASDF has some circular error case, where a stub that is non executable causes bizarre error messages (because asdf is parsing its own error output to determine something about the shim). Not a big issue though, as long as one’s shims are all proper.

This popped up for me and I have no idea what is causing it.

⚙️ direnv global defaults: [bash]                                                                                                                                                      
direnv: ([/Users/USERNAME/.asdf/installs/direnv/2.30.3/bin/direnv export zsh]) is taking a while to execute. Use CTRL-C to give up.
/Users/USERNAME/.asdf/lib/utils.bash:234: ASDF_.DS_STORE_VERSION: invalid variable name

For me

rm $ASDF_DATA_DIR/plugins/.DS_Store

seemed to do the trick

Closing as I’ve not gotten any responses on whether this issue still exists with the latest version. I will reopen if not resolved.

I’m encountering this too, but weirdly, only in CI, while invoking asdf inside a Docker image that I have previously built. Tt does not reproduce locally for me. I pasted some things you’ve asked others for, but I don’t think the issue involves stray files under ~/.asdf/plugins in my case.

My findings: cannot identify shim as executable

I narrowed it down to shim_plugin_versions and specifically to this conditional:

  if [ -x "$shim_path" ]; then                           
    grep "# asdf-plugin: " "$shim_path" 2>/dev/null | sed -e "s/# asdf-plugin: //" | uniq
  else                    
    printf "asdf: unknown shim %s\\n" "$executable_name"
    return 1                                    
  fi                                  

shim_path is /var/www/.asdf/shims/bundle in this case, and in fact I can reproduce the test from the bash CLI:

bash-5.1$ if [ -x /var/www/.asdf/shims/bundle ]; then echo "is executable"; else echo "is not executable"; fi
is not executable

However, it looks executable to me! I don’t understand why the -x test is failing; I tried adding a proper space to the shebang line (#! /usr/bin/env bash) as well as just directly invoking bash (#! /bin/bash).

Obviously I can invoke this shim (it’s how we get into the error condition in the first place!) but something makes bash 5 think it’s not executable.

-rwxr-xr-x    1 www-data www-data       121 May  6 20:09 /var/www/.asdf/shims/bundle

Marginally useful troubleshooting info

bash-5.1$ ls -la ~/.asdf/plugins
total 12
drwxr-sr-x    1 www-data www-data      4096 May  4 23:18 .
drwxr-sr-x    1 www-data www-data      4096 May  4 23:28 ..
drwxr-sr-x    1 www-data www-data      4096 May  4 23:18 ruby
bash-5.1$ asdf info
OS:
Linux 829230640ef8 5.4.0-1021-gcp #21-Ubuntu SMP Fri Jul 10 06:53:47 UTC 2020 x86_64 Linux

SHELL:
This account is not available

ASDF VERSION:
v0.10.0-77fd510

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/var/www/.asdf

ASDF INSTALLED PLUGINS:
ruby                         https://github.com/asdf-vm/asdf-ruby.git master 95bb530