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

erl -man <module name> doesn't work #310

Open
jrfondren opened this issue May 9, 2024 · 2 comments
Open

erl -man <module name> doesn't work #310

jrfondren opened this issue May 9, 2024 · 2 comments

Comments

@jrfondren
Copy link

jrfondren commented May 9, 2024

Previously reported and fixed in #22

$ asdf install erlang 26.2.5
asdf_26.2.5 is not a kerl-managed Erlang/OTP installation
No build named asdf_26.2.5
Downloading 26.2.5 to /home/jrfondren/.asdf/downloads/erlang/26.2.5...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  101M  100  101M    0     0  19.3M      0  0:00:05  0:00:05 --:--:-- 21.1M
Extracting source code
Building Erlang/OTP 26.2.5 (asdf_26.2.5), please wait...
[packages] Unknown Linux distro rocky; not checking build packages.
Building docs...
Erlang/OTP 26.2.5 (asdf_26.2.5) has been successfully built
Cleaning up compilation products for asdf_26.2.5
Cleaned up compilation products for asdf_26.2.5 under /home/jrfondren/.asdf/plugins/erlang/kerl-home/builds
$ which erl
~/.asdf/shims/erl
$ erl -s init stop
Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

$ erl -man erl
No manual entry for erl
$ fop |head -3
FOP Version SVN

USAGE

A strace of erl -man erl shows it trying

15:41:19 openat(AT_FDCWD, "/home/jrfondren/.asdf/installs/erlang/26.2.5/man", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
15:41:19 newfstatat(AT_FDCWD, "/home/jrfondren/.asdf/installs/erlang/26.2.5/man", 0x7ffc52e1d130, 0) = -1 ENOENT (No such file or directory)

The only 'man' directory under ~/.asdf that I have is empty, ~/.asdf/installs/erlang/26.2.5/erts-14.2.5/man

workaround

Open module documentation with xdg-open https://www.erlang.org/doc/man/$module instead. I.e.,

$ function erlman() { xdg-open https://www.erlang.org/doc/man/$1; }
$ erlman erl  # opens the 'erl' manpage in another tab of the default browser

Manpages have many advantages that this misses, such as always being for the correct version of Erlang.

post-build fix

$ function getman() { wget https://github.com/erlang/otp/releases/download/OTP-$1/otp_doc_man_$1.tar.gz && tar -C ~/.asdf/installs/erlang/$1/ -zxvf otp_doc_man_$1.tar.gz && rm -fv otp_doc_man_$1.tar.gz; }
$ getman 26.2.5
$ getman 27.0-rc3
@03juan
Copy link

03juan commented May 10, 2024

There's a very recent upstream fix in kerl/kerl#520 for this, currently only on the main branch.

You can recompile with

$ export ASDF_KERL_VERSION=master
export KERL_BUILD_DOCS=yes
export KERL_DOC_TARGETS="chunks man"
export KERL_INSTALL_MANPAGES=yes

$ asdf install erlang 26.2.5     
Downloading kerl...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 82416  100 82416    0     0  1787k      0 --:--:-- --:--:-- --:--:-- 1829k
ERROR: 'asdf_26.2.5' is not a kerl-managed Erlang/OTP installation.
ERROR: no build named 'asdf_26.2.5'!
Downloading (from GitHub) Erlang/OTP 26.2.5 to /home/juan/.asdf/downloads/erlang/26.2.5...
Extracting source code for normal build...
Building (normal) Erlang/OTP 26.2.5 (asdf_26.2.5); please wait...
Initializing (build) log file at /home/juan/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.5/otp_build_26.2.5.log.
Building docs...
Erlang/OTP 26.2.5 (asdf_26.2.5) has been successfully built.
Cleaning up compilation products for 'asdf_26.2.5' under:
  - /home/juan/.asdf/plugins/erlang/kerl-home/builds...
  - /home/juan/.asdf/downloads/erlang/26.2.5...
... done.

$ asdf global erlang 26.2.5
$ erl -man erl
erl(1)                                     User Commands                                    erl(1)

NAME
       erl - The Erlang emulator.

@Stratus3D
Copy link
Member

Once a new version of kerl is tagged I'll get this fix into asdf-erlang.

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

No branches or pull requests

3 participants