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: getting "You have configured asdf to preserve downloaded files" when I don't #1711

Closed
Mellbourn opened this issue Jan 21, 2024 · 6 comments · Fixed by #1756
Closed

bug: getting "You have configured asdf to preserve downloaded files" when I don't #1711

Mellbourn opened this issue Jan 21, 2024 · 6 comments · Fixed by #1756
Labels

Comments

@Mellbourn
Copy link

Describe the Bug

Every time I install a new version using asdf, I always get the warning "You have configured asdf to preserve downloaded files"
To start with I had no .asdfrc file, so that was strange.
Then I even created a .asdfrc file with an explicit setting always_keep_download = no but the warning persists.

Content of my $HOME/.asdfrc file:

legacy_version_file = yes
always_keep_download = no

Steps to Reproduce

  1. install something, e.g.
> asdf install direnv 2.31.0

Expected Behaviour

The following output only:

∗ Downloading and installing direnv...
The installation was successful!

Actual Behaviour

I always get two rows of warnings at the end of any installation:

∗ Downloading and installing direnv...
The installation was successful!
asdf: Warn: You have configured asdf to preserve downloaded files (with always_keep_download=yes or --keep-download). But
asdf: Warn: the current plugin (direnv) does not support that. Downloaded files will not be preserved.

Environment

OS:
Darwin Klass-MacBook-Pro-16-2023.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020 arm64

SHELL:
zsh 5.9 (x86_64-apple-darwin23.0)

BASH VERSION:
5.2.26(1)-release

ASDF VERSION:
v0.14.0-ccdd47d

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/klas.mellbourn/.asdf
ASDF_DIR=/Users/klas.mellbourn/.asdf
ASDF_CONFIG_FILE=/Users/klas.mellbourn/.asdfrc

asdf plugins affected (if relevant)

ASDF INSTALLED PLUGINS:
bundler [email protected]:jonathanmorley/asdf-bundler.git master a461ac4
direnv [email protected]:asdf-community/asdf-direnv.git master a2219c2
java [email protected]:halcyon/asdf-java.git master fc28b48
lazydocker [email protected]:comdotlinux/asdf-lazydocker.git master abb6f71
nodejs [email protected]:asdf-vm/asdf-nodejs.git master c5b7c40
python [email protected]:danhper/asdf-python.git master 5e277e2
ruby [email protected]:asdf-vm/asdf-ruby.git master 7a22142

@Mellbourn Mellbourn added the bug label Jan 21, 2024
@Birdie0
Copy link

Birdie0 commented Jan 30, 2024

Warning was introduced in this commit but I guess condition is incorrect, it's triggered when both always_keep_download in .asdfrc isn't set to yes and --keep-download isn't provided, together with download directory missing.

@reegnz
Copy link

reegnz commented Feb 1, 2024

I'm also facing this issue.
Interestingly if I set always_keep_download = yes it doesn't complain, so I think the flag check is botched and does the reverse of what it actually should.

@gurrenPizza
Copy link

I've also faced this issue after adding the zsh-adf-direnv plugin for zsh. It is the same message and it showed up the first time I ran terminal after installing it, but I've managed to install sqlite (which is what I wanted to install with asdf) through asdf without the message and it didn't show up the next times I opened terminal.

Environment:

OS: Pop!_OS 22.04 LTS x86_64 
Shell: zsh 5.8.1
BASH version: 5.1.16(1)-release
asdf version: v0.14.0-ccdd47d

Birdie0 added a commit to Birdie0/asdf that referenced this issue Feb 19, 2024
Birdie0 added a commit to Birdie0/asdf that referenced this issue Feb 19, 2024
Birdie0 added a commit to Birdie0/asdf that referenced this issue Feb 19, 2024
Birdie0 added a commit to Birdie0/asdf that referenced this issue Feb 19, 2024
@klippx
Copy link

klippx commented Apr 19, 2024

@Mellbourn Hello there! 👋

I also have this issue, I am not using a .asdfrc but rather a .tool-versions and I am getting this warning on CI only, from the action asdf-vm/actions/install@v2. I guess it could be related.

Will the PR be merged "soon" ? 😅

@doolio
Copy link

doolio commented Apr 25, 2024

I also experience this behaviour with asdf v0.14.0-ccdd47d.

benblank added a commit to benblank/asdf that referenced this issue May 12, 2024
Currently, the warning which is intended to alert users that the download directory can't be kept only appears if they haven't asked for it to be. This change just rearranges the logic a bit so that the warning instead only appears if the download directory *should* be kept, but *can't* be kept (because it doesn't exist).

fixes asdf-vm#1711
@benblank
Copy link
Contributor

Looking at the current code, it does indeed look like the test is "reversed", but in the sense that the existing test needed to be inverted (and the clauses rearranged) in 19515ed, but wasn't. Probably just a simple brain fart. 🙂

# Remove download directory if --keep-download flag or always_keep_download config setting are not set
always_keep_download=$(get_asdf_config_value "always_keep_download")
if [ ! "$keep_download" = "true" ] && [ ! "$always_keep_download" = "yes" ]; then
if [ -d "$download_path" ]; then
rm -r "$download_path"
else
printf '%s\n' "asdf: Warn: You have configured asdf to preserve downloaded files (with always_keep_download=yes or --keep-download). But" >&2
printf '%s\n' "asdf: Warn: the current plugin ($plugin_name) does not support that. Downloaded files will not be preserved." >&2
fi
fi

Basically, the current logic is "if not should-keep, (if exists, delete, else, warn)" but needs to be "if should-keep, (if not exists, warn), else (if exists, delete)". I just put together PR #1756, which should hopefully fix things.

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