asdf icon indicating copy to clipboard operation
asdf copied to clipboard

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

Open Mellbourn opened this issue 1 year ago • 6 comments

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 avatar Jan 21 '24 22:01 Mellbourn

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.

Birdie0 avatar Jan 30 '24 11:01 Birdie0

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.

reegnz avatar Feb 01 '24 13:02 reegnz

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

gurrenPizza avatar Feb 19 '24 00:02 gurrenPizza

@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" ? 😅

klippx avatar Apr 19 '24 08:04 klippx

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

doolio avatar Apr 25 '24 12:04 doolio

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. 🙂

https://github.com/asdf-vm/asdf/blob/ccdd47df9b73d0a22235eb06ad4c48eb57360832/lib/functions/installs.bash#L237-L246

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.

benblank avatar May 12 '24 17:05 benblank