asdf-ruby icon indicating copy to clipboard operation
asdf-ruby copied to clipboard

Wrong cellar path

Open manuraj17 opened this issue 3 years ago • 5 comments

Noticed this behaviour with asdf and ruby gems recently. I have had asdf installed for a while now. I use it for all my language versioning.

Recently after installing gems at a global level and after asdf reshim I found that the shim file created points to a wrong cellar. I manually updated and it started working. Not sure what I missed here or is it a genuine issue. If someone can direct on how I can gather data/steps I can dig into this further.

Output of asdf info

SHELL:
zsh 5.8.1 (x86_64-apple-darwin21.0)

ASDF VERSION:
v0.10.2

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/usr/local/Cellar/asdf/0.10.2/libexec

ASDF INSTALLED PLUGINS:
elixir                       https://github.com/asdf-vm/asdf-elixir.git master 8d018f2
erlang                       https://github.com/asdf-vm/asdf-erlang.git master 98139db
flutter                      https://github.com/oae/asdf-flutter.git master d108efd
golang                       https://github.com/kennyp/asdf-golang.git master cc8bc47
java                         https://github.com/halcyon/asdf-java.git master 67a9c5a
kotlin                       https://github.com/asdf-community/asdf-kotlin.git master af9ab2c
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master f9957f3
python                       https://github.com/danhper/asdf-python.git master 57a4d72
ruby                         https://github.com/asdf-vm/asdf-ruby.git master 95bb530
rust                         https://github.com/code-lever/asdf-rust.git master 0c88f99

I installed the rufo gem and the shim file has content as below

❯ cat /Users/manuraj/.asdf/shims/rufo
#!/usr/bin/env bash
# asdf-plugin: ruby 3.0.3
# asdf-plugin: ruby 3.1.1
exec /usr/local/Cellar/asdf/0.9.0/libexec/bin/asdf exec "rufo" "$@"

The cellar path should be of version 0.10.2 in the info but 0.9.0 due to which I was not able to access rufo globally. I manually changed and it is now

❯ cat /Users/manuraj/.asdf/shims/rufo
#!/usr/bin/env bash
# asdf-plugin: ruby 3.0.3
# asdf-plugin: ruby 3.1.1
exec /usr/local/Cellar/asdf/0.10.2/libexec/bin/asdf exec "rufo" "$@"

And rufo works now.

Apologies in advance for this vague issue, I really like to figure what went wrong but am not sure where to start.

manuraj17 avatar Aug 12 '22 09:08 manuraj17

I encountered this exact issue in the wild. With rufo as well as with rubocop. I think this is a wider issue that must have been introduced in a recent update to the ruby ASDF plugin.

Qqwy avatar Aug 18 '22 13:08 Qqwy

@Qqwy Interesting, what did you face with rubocop? I was checking rubocop and it doesn't be configured like rufo (Now that I said this, I doubt if I have it installed globally, hhmm) Anyways, was rubocop also having exact issue?

manuraj17 avatar Aug 19 '22 10:08 manuraj17

Upon reflection, I think my problem might have been caused by something else. My GEM_PATH was all messed up for some reason. If I figure out what was happening exactly I will let you know. But before then: please disregard my earlier message :sweat_smile:.

Qqwy avatar Aug 21 '22 17:08 Qqwy

Hi,

I faced some similar issue here.

I use asdf for deploy in some scenarios where I need more than one version of ruby, using systemd scripts for startup.

But recently, the "bundle" script command (e.g: /path/to/.asdf/installs/ruby/3.1.2/bin/bundle), for example, points to "#!/usr/bin/env ruby" instead of "/path/to/.asdf/installs/ruby/3.1.2/bin/ruby", and the startup fails. So, I need to edit all scripts to point to correct ruby version.

EDIT: It doesn't occur in all scripts, however.

edsonlima avatar Dec 27 '22 19:12 edsonlima

All my ruby shims recently (within the last year) broke. All point to 0.10.1 instead of 0.10.2. I have been fixing them manually as needed. I don't know what caused it, but it was a somewhat recent change, probably in the last year. I don't know if it affected other asdf plugins, as I mostly use Ruby, but IIRC there are other issues for this same problem in the tracker.

pboling avatar Dec 27 '22 21:12 pboling