Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
4461-Include-the-error-reason-when-loading-a-ni...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4461-Include-the-error-reason-when-loading-a-nif-fails.patch of Package erlang
From 8ff7b2f27acde48c6bf16e9713d1a3c09027dccf Mon Sep 17 00:00:00 2001 From: Dominic Letz <dominic@diode.io> Date: Tue, 14 Sep 2021 11:41:00 +0200 Subject: [PATCH] Include the error reason when loading a nif fails When a nifs `on_load` function returns a non-ok value loading fails today silently without showing the returned error reason. This is especially sad when the `on_load` callback is calling `erlang:load_nif/2` as it lasts statement which many nif `on_load` callbacks do. `erlang:load_nif/2` typically returns quite helpful error tuples that help to identify the reasons for why the nif failed loading. This change makes the error message appear in the output and in debug messages when debugging is enabled. ```erlang -on_load(init/0). init() -> SoName = filename:join(code:priv_dir(?APPNAME), ?LIBNAME), erlang:load_nif(SoName, 0). ``` --- erts/preloaded/src/init.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erts/preloaded/src/init.erl b/erts/preloaded/src/init.erl index 5b59a9d65f..42d6d6ea7b 100644 --- a/erts/preloaded/src/init.erl +++ b/erts/preloaded/src/init.erl @@ -1475,7 +1475,7 @@ run_on_load_handlers([M|Ms], Debug) -> erlang:finish_after_on_load(M, Keep), case Keep of false -> - Error = {on_load_function_failed,M}, + Error = {on_load_function_failed,M,OnLoadRes}, debug(Debug, Error), exit(Error); true -> -- 2.31.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor