asdf-vm / asdf-erlang

Erlang plugin for asdf version manager

Home Page:https://github.com/asdf-vm/asdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: potential issue of Installing erlang on Mac

hugo-tubi opened this issue · comments

Describe the Bug

I found re-install erlang is not working. Anyone else using macos can reproduce this issue? Or it just some issues of my machine.

Steps to Reproduce

$ asdf plugin add erlang
$ asdf install erlang 25.2

# uninstall it
$ asdf uninstall erlang

# reinstall it
$ asdf install erlang 25.2

Expected Behaviour

erlang 25.2 is installed.

Actual Behaviour

The (re)install step says greenly "Erlang/OTP 25.2 (asdf_25.2) has been successfully built"
BUT exits with status code 1.

asdf list erlang says "No versions installed". Directory ~/.asdf/installs/erlang/ is totally empty.

Environment

OS:
Darwin Hugo 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64 arm Darwin

SHELL:
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin22)
Copyright (C) 2007 Free Software Foundation, Inc.

ASDF VERSION:
v0.11.0-6a4f51a

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/Users/hugo/.asdf

ASDF INSTALLED PLUGINS:
elixir                       https://github.com/asdf-vm/asdf-elixir.git master 1693b35
erlang                       https://github.com/asdf-vm/asdf-erlang.git master 0d402e6

asdf plugins affected (if relevant)

erlang

@hugo-tubi Typically if you see an issue like this it is best to discuss at the plugin repo first to ensure it's not the plugin before raising in asdf core repo. I have moved the issue to the erlang plugin repo.

Just tried install 25.1.2, and it installed with no issues.

Following is the installing logs for 25.1.2 (succeed) and 25.2 (failed)

$ asdf install erlang 25.1.2
asdf_25.1.2 is not a kerl-managed Erlang/OTP installation
No build named asdf_25.1.2
Downloading 25.1.2 to /Users/hugo/.asdf/downloads/erlang/25.1.2...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 98.8M  100 98.8M    0     0   136k      0  0:12:19  0:12:19 --:--:--  160k
Extracting source code
Building Erlang/OTP 25.1.2 (asdf_25.1.2), please wait...
APPLICATIONS DISABLED (See: /Users/hugo/.asdf/plugins/erlang/kerl-home/builds/asdf_25.1.2/otp_build_25.1.2.log)
 * jinterface     : No Java compiler found
 * odbc           : ODBC library - link check failed

DOCUMENTATION INFORMATION (See: /Users/hugo/.asdf/plugins/erlang/kerl-home/builds/asdf_25.1.2/otp_build_25.1.2.log)
 * documentation  :
 *                  fop is missing.
 *                  Using fakefop to generate placeholder PDF files.

Erlang/OTP 25.1.2 (asdf_25.1.2) has been successfully built
Cleaning up compilation products for
Cleaned up compilation products for  under /Users/hugo/.asdf/plugins/erlang/kerl-home/builds
hugo@bash: ~$
hugo@bash: ~$ asdf install erlang 25.1.2
erlang 25.1.2 is already installed
hugo@bash: ~$
hugo@bash: ~$ asdf install erlang 25.2
asdf_25.2 is not a kerl-managed Erlang/OTP installation
The asdf_25.2 build has been deleted
Extracting source code
Building Erlang/OTP 25.2 (asdf_25.2), please wait...
APPLICATIONS DISABLED (See: /Users/hugo/.asdf/plugins/erlang/kerl-home/builds/asdf_25.2/otp_build_25.2.log)
 * jinterface     : No Java compiler found
 * odbc           : ODBC library - link check failed

Erlang/OTP 25.2 (asdf_25.2) has been successfully built

NOTE: above install 25.1.2 succeed with exit status 0, and two more "clean up" output at the end. But not 25.2

I reproduced the issue after uninstall 25.1.2, the uninstall log:

$ asdf uninstall erlang
asdf_24.1 /Users/honggangwang/.asdf/installs/erlang/24.1
asdf_25.2 /Users/honggangwang/.asdf/installs/erlang/25.2
asdf_25.1.2 /Users/honggangwang/.asdf/installs/erlang/25.1.2
No build named asdf_
/Users/honggangwang/.asdf/installs/erlang/ is not a kerl-managed Erlang/OTP installation

After uninstalling, I cannot install 25.1.2 again.

Found something: During the .../kerl install asdf_25.2 /path/to/erlang/25.2 an error shows up:

ERROR: Installation (asdf_25.2) already registered for this location (/Users/hugo/.asdf/installs/erlang/25.2)

This error is hidden during normal installation, because it want to hide normal outputs (end up also hidden useful errors)

$(kerl_path) install "$build_name" "$ASDF_INSTALL_PATH" >/dev/null 2>&1

I'm new to asdf, still digging into what/why is this "already registered".

I found the reason of the original issue. It is because I uninstall erlang with

asdf uninstall erlang

This make the kerl inside plugin erlang (.asdf/plugins/erlang/kerl-home/otp_installation etc) into a stale state, which break the re-install. If under a normal status, I uninstall it with a:

asdf uninstall erlang 25.2

The re-installation would be ok.

However, I think asdf should still able to handle the situations after a "bad" asdf uninstall erlang command. Or refuse to run this command (without providing a version), so that kerl status would get into stale.

Thanks so much @hugo-tubi!

I ran into the same issue. I made the mistake of running asdf uninstall erlang without a version number—doh!! 😱

The issue was fixed for me by running:

  1. asdf plugin remove erlang
  2. asdf plugin add erlang
  3. asdf install erlang 25.1.2

Closing since #267 has been merged.