Erlang/OTP 26.0-rc1 (Release Candidate 1) is released

That is a bug, the intended behavior is like you said, thanks!

3 Likes
erl -noshell -eval "io:format(\"hello\")." -s init stop

And it’s logical.

1 Like

Yes I see.

Another possibility is this:

erl -noshell -eval "io:format(\"hello\"), halt()."
1 Like

I had opened up a bug report on this, but figured that they way this was being done was simply not a great to go about it (i.e., had lucked out in the past), I have re-opened the issue :

1 Like

Sorry, the confirmation of a bug was a respons to dominic’s shell completion feedback.

I have now looked into the isues with -s init stop, its working as intended:

According to documentation
-eval expressions are evaluated sequentially with -s and -run function calls (this also in the order specified) .

2 Likes

Interesting. This was in the Makefile of a dep. (bcrypt/Makefile at master · erlangpack/bcrypt · GitHub). This was used since OTP 18 or 19.

Anyhow, I opened a PR to fix this.

2 Likes

Might have found a bug, it depends :wink:

There’s some nifs out there in the world that make use of the file server (for determining the path a shared object as an example). This is broken in OTP-26, but it may be intentional, it’s not clear from the notes. It might be around this PR: Update on_load handling during boot by RaimoNiskanen · Pull Request #6817 · erlang/otp · GitHub

Happy to open an issue if needed.

2 Likes

The intention of that PR is, as it says, to simplify on_load handling during boot. Then we had to decide when, during boot, in embedded mode, to run the on_load handlers.

The change in rc1 places them after the code server and stderr, but before distribution and the file server, hoping that NIF on_load handlers could do with the code server’s features and maybe some filelib functions, but not need the file server.

The problem is that the little known feature “remote file server” requires the file server to be started after the Erlang distribution. The distribution (when using SSL/TLS) needs the crypto NIF to be loaded so, distribution needs to be after on_load. Hence, for NIF:s using the file server we have a circular dependency.

We aim to fix this to rc2 and start the file server before the on_load handlers when the remote file server is not used, meaning that if using remote file server (the -master) command line argument, NIF:s needing the file server cannot be used in the system.

I do not know yet how to solve this “properly”. Kenneth has asked for how many that use the remote file server, and there seem to be some, otherwise removing that feature would resolve this. Another solution would be to declare that NIF on_load functions cannot use the file server, and probably extend the code server with some file server like features they in that case would need.

The area is … complicated …, we have the code server that uses the prim loader that can be the file prim loader which uses the local file system, or the net prim loader that loads over a simple network protocol towards some IP address (where an erl_boot_server uses that node’s file server). Then, later the code server switches to using the file server that can be on a remote node, unrelated to the net prim loader and to the local file system. And NIF:s (today) have to be loaded from the local file system via dlopen() or similar.

NIF:s have to be able to figure out a path suitable for dlopen(), and we need to figure out how that should be done in all supported setups, then define what API:s the NIF:s are allowed to use in their on_load handlers.

4 Likes

I had no idea how complicated this was. Thank you so much for that highly informative response!

1 Like

I have merged a continuation of PR#6817, that starts the file server early if possible, into ‘master’ for OTP-26.0-rc2

2 Likes

I’ll give that try today and report back results.

1 Like

This worked like a charm.

2 Likes