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

bug: command-help invokes with incorrect directory #1540

Closed
hughrawlinson opened this issue Apr 14, 2023 · 4 comments · Fixed by #1593
Closed

bug: command-help invokes with incorrect directory #1540

hughrawlinson opened this issue Apr 14, 2023 · 4 comments · Fixed by #1593
Labels

Comments

@hughrawlinson
Copy link

Describe the Bug

I am aiming to move my asdf installation to a separate directory. I've set ASDF_DIR and ASDF_DATA_DIR to the target directory and cloned asdf as per the installation instructions to that directory. I can source asdf.fish correctly, but when I invoke asdf, I get the following output:

/mnt/e/.hugh_asdf/lib/commands/command-help.bash: line 3: /mnt/e/.hugh_asdf/lib/lib/functions/versions.bash: No such file or directory
/mnt/e/.hugh_asdf/lib/commands/command-help.bash: line 6: asdf_version: command not found
version:

/mnt/e/.hugh_asdf/lib/commands/command-help.bash: line 7: asdf_dir: command not found
cat: /help.txt: No such file or directory
/mnt/e/.hugh_asdf/lib/commands/command-help.bash: line 20: get_plugin_path: command not found

"Late but latest"
-- Rajinikanth

As you can see, line 3 of command-help.bash ends up with lib twice, and therefore it can't find the right file.

Steps to Reproduce

  1. Set ASDF_DIR and ASDF_DATA_DIR to the target directory
  2. Install asdf to that directory
  3. Source asdf.fish
  4. Invoke asdf

I've also confirmed that when I run bash and source asdf.sh, I get the same output.

Expected Behaviour

I would expect to see the output of the asdf help command.

Actual Behaviour

The command output errors described above.

Environment

/mnt/e/.hugh_asdf/lib/commands/command-info.bash: line 3: /mnt/e/.hugh_asdf/lib/lib/functions/plugins.bash: No such file or directory
OS:
Linux DESKTOP-EOBJPH0 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

SHELL:
fish, version 3.5.0

/mnt/e/.hugh_asdf/lib/commands/command-info.bash: line 8: asdf_version: command not found
ASDF VERSION:


ASDF ENVIRONMENT VARIABLES:
ASDF_DATA_DIR=/mnt/e/.hugh_asdf
ASDF_DIR=/mnt/e/.hugh_asdf

/mnt/e/.hugh_asdf/lib/commands/command-info.bash: line 10: plugin_list_command: command not found
ASDF INSTALLED PLUGINS:

asdf plugins affected (if relevant)

None

@hyperupcall
Copy link
Contributor

hyperupcall commented Apr 17, 2023

I should probably note that WSL isn't supported and we don't test on WSL - this issue is tracked by #450

That said, there have been some recent changes to the Fish files that may have caused this issue. I'm on Linux Mint and I am unable to reproduce on HEAD

@hughrawlinson
Copy link
Author

Oh wow, I didn't realize that. I should potentially consider moving to something else then I guess!

@willnorris
Copy link

For anyone else running into this, it is likely that you have the executable bit set on your $ASDF_DIR/lib/command/* files. You can see in the code here, if the executable bit is set, asdf runs them in a subshell with exec, which changes the value of $0. You can fix this simply by removing the executable bit:

chmod -x $ASDF_DIR/lib/commands/*

@cocoonkid
Copy link

@willnorris having this issue out of the blue on ansible installed user profiles that utilize asdf.

Thanks for your fix! saved my weekend :)
I

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants