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: "ref:foo" regression in golang rewrite #2001

Closed
elijahr opened this issue Mar 2, 2025 · 1 comment · Fixed by #2049
Closed

bug: "ref:foo" regression in golang rewrite #2001

elijahr opened this issue Mar 2, 2025 · 1 comment · Fixed by #2049
Labels

Comments

@elijahr
Copy link
Contributor

elijahr commented Mar 2, 2025

Describe the Bug

Greetings! I am the author of https://github.com/asdf-community/asdf-nim. I make regular use of the ref:foo tool identifier syntax to install nightly builds of certain git branches when available, or fallback to building from source when not available.

ref:foo seems to install ok, but asdf fails to find or use the installed version:

export ASDF_NIM_VERSION=ref:version-2-2
asdf install nim # works
asdf which nim # fails with `No nim executable found for nim`
asdf reshim
asf which nim # still fails with `No nim executable found for nim`

If I do this, it does show that the the version has been installed (with ":" replaced by "-"):

$ asdf list nim
  ref-version-2-2

So, the ref: identifier works okay for installation, but not for shims or calling which.

There is a hacky workaround, which is setting ASDF_NIM_VERSION=ref-version-2-2 after ref:version-2-2 has been installed.

Steps to Reproduce

Here is a minimal Dockerfile to reproduce:

FROM debian:bookworm-slim

ENV ASDF_DATA_DIR="/root/.asdf"
ENV PATH="${ASDF_DATA_DIR}/shims:/root/.nimble/bin:/usr/local/go/bin:$PATH"
# 2.2 nightly build
ENV ASDF_NIM_VERSION="ref:version-2-2"

# Install dependencies
RUN apt-get update && apt-get install -y \
    curl \
    git \
    build-essential \
    libssl-dev \
    coreutils \
    && rm -rf /var/lib/apt/lists/*

# Install golang (req of asdf)
RUN curl -fsSL https://go.dev/dl/go1.24.0.linux-arm64.tar.gz | tar -C /usr/local -xz

# Install asdf, asdf-nim, and nim
RUN git clone https://github.com/asdf-vm/asdf.git --depth 1 --branch v0.16.4 && \
    cd asdf && \
    make && \
    ln -s ${PWD}/asdf /usr/local/bin/asdf && \
    asdf plugin add nim && \
    asdf install && \
    asdf reshim

# Fails with:
# No executable nim found for current version. Please select a different version or install nim manually for the current version
RUN nim -v

Expected Behaviour

asdf should find and execute nim using ref:version-2-2 in ASDF_NIM_VERSION or a .tool-versions file.

Actual Behaviour

asdf cannot execute nim when the tool version is ref:version-2-2.

Environment

# asdf info
OS:
Linux f59c3c778768 6.12.5-linuxkit #1 SMP Tue Jan 21 10:23:32 UTC 2025 aarch64 GNU/Linux

SHELL:
GNU bash, version 5.2.15(1)-release (aarch64-unknown-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

BASH VERSION:
5.2.15(1)-release

ASDF VERSION:
"4b9297b-dev"

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/root/.asdf
ASDF_CONFIG_FILE=/root/.asdfrc

ASDF INSTALLED PLUGINS:
nim       https://github.com/asdf-community/asdf-nim.git d35061b74828466fb3c204d76de57b94a02d2176

asdf plugins affected (if relevant)

asdf-nim

@Morgahl
Copy link
Contributor

Morgahl commented Apr 2, 2025

I have been having the same issue but as it relates to ref builds for erlang and elixir. I have prepared a PR that ostensibly resolves this issue #2049.

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.

2 participants