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: always_keep_download has a wrong warning logic #1752

Closed
C0deBr3ak3r opened this issue May 3, 2024 · 2 comments
Closed

bug: always_keep_download has a wrong warning logic #1752

C0deBr3ak3r opened this issue May 3, 2024 · 2 comments
Labels

Comments

@C0deBr3ak3r
Copy link

C0deBr3ak3r commented May 3, 2024

Describe the Bug

A warn is show stating that you have set the option always_keep_download to yes or used the option --keep-download while neither of those where set.
The bug is in file lib/functions/installs.bash at line 239

Steps to Reproduce

  1. Clone the asdf-vm repo
  2. Use default settings or explicit set always_keep_download to no in asdfrc
  3. Add a plugin that doesn't support keep_downloads, for example deno
  4. Try to install any version of deno runtime
  5. See the warning message

Expected Behaviour

The warning message shouldn't be trigger

Actual Behaviour

A warning message for unsupported option always_keep_download in plugin is triggered

Environment

OS:
Linux moonchild 6.8.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 02 May 2024 17:49:46 +0000 x86_64 GNU/Linux

SHELL:
zsh 5.9 (x86_64-pc-linux-gnu)

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=/home/moon/.asdf
ASDF_DIR=/home/moon/.asdf
ASDF_CONFIG_FILE=/home/moon/.config/.asdfrc

ASDF INSTALLED PLUGINS:
deno                         https://github.com/asdf-community/asdf-deno.git master fec2a08

asdf plugins affected (if relevant)

No response

@C0deBr3ak3r C0deBr3ak3r added the bug label May 3, 2024
@C0deBr3ak3r
Copy link
Author

C0deBr3ak3r commented May 3, 2024

lines: 237 up to 246 in file lib/functions/installs.bash

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

It's checking if keep_downloadis not equal to truenor yes and tries to remove the directory, however if the directory does not exist it shows the warning, the warning should be behind a check to see if the option is set

@C0deBr3ak3r
Copy link
Author

Oh sorry, duplicate of #1711 . Closing it

@C0deBr3ak3r C0deBr3ak3r closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant