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

Allow unset ASDF_DIR environment variable #163

Merged
merged 1 commit into from
Nov 1, 2021

Conversation

SgtPooki
Copy link
Contributor

Resolves the following error that displays for users who do not set ASDF_DIR:

$HOME/.asdf/plugins/java/bin/list-all: line 3: /lib/utils.bash: No such file or directory

As indicated in the official asdf docs, ASDF_DIR should default to ~/.asdf, though asdf itself defaults to $HOME/.asdf:

ASDF_DIR - Defaults to ~/.asdf - Location of the asdf scripts. If you install asdf to some other directory, set this to that directory. For example, if you are installing via the AUR, you should set this to /opt/asdf-vm.

Resolves the following error that displays for users who do not set ASDF_DIR:

    $HOME/.asdf/plugins/java/bin/list-all: line 3: /lib/utils.bash: No such file or directory

As indicated in the [official asdf docs][asdf docs], `ASDF_DIR` should default to `~/.asdf`, though asdf itself defaults to `$HOME/.asdf`:

> ASDF_DIR - Defaults to ~/.asdf - Location of the asdf scripts. If you install asdf to some other directory, set this to that directory. For example, if you are installing via the AUR, you should set this to /opt/asdf-vm.

[asdf docs]: http://asdf-vm.com/manage/configuration.html#environment-variables
@halcyon
Copy link
Owner

halcyon commented Sep 29, 2021

I'm trying to understand this use case. It looks like ASDF_DIR is set when asdf is loaded. https://github.com/asdf-vm/asdf/blob/master/asdf.sh#L14-L15

In what situation would ASDF_DIR not be set?

@SgtPooki
Copy link
Contributor Author

SgtPooki commented Nov 1, 2021

In what situation would ASDF_DIR not be set?

There are a large number of circumstances that could result in ASDF_DIR not being set. Here are a few I can think of:

  1. https://github.com/asdf-community/asdf-direnv, which requires explicitly not sourcing asdf.sh so that the shims won't interfere. (my scenario)
  2. If asdf-vm stops setting ASDF_DIR
  3. The eventual event that always proves assumptions wrong.

This plugin has already seen two users (#152) impacted by the assumption that ASDF_DIR is defined.

Either way, is not safeguarding a variable that you don't control a good idea?

@halcyon halcyon merged commit e883d24 into halcyon:master Nov 1, 2021
@halcyon
Copy link
Owner

halcyon commented Nov 1, 2021

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants