ninenines / erlang.mk

A build tool for Erlang that just works.
https://erlang.mk
ISC License
580 stars 238 forks source link

make dialyze fails if user_default (or other) writes to stdout #569

Closed jaynel closed 6 years ago

jaynel commented 8 years ago
jay$ make dialyze

Crash dump is being written to: erl_crash.dump...done
init terminating in do_boot ()
Loading user defaults {module,user_default}

dialyzer: Unknown option: Loading
make: *** [dialyze] Error 1

I have a ~/.erlang file with the following in it:

UD = code:load_abs("/Users/jay/Google Drive/Erlang Code/user_default").
io:format("Loading user defaults ~p~n", [UD]).

If I comment out the io:format I get a different error, due to unexpected stdout data:

jay$ make dialyze

Crash dump is being written to: erl_crash.dump...done
init terminating in do_boot ()

dialyzer: Unknown option: {"init
make: *** [dialyze] Error 1

When I add the following to Makefile, I can run dialyzer with 'make my_dialyzer':

my_dialyzer:
    dialyzer --plt .ananke.plt --no_native --src -r src -I include -Werror_handling -Wrace_conditions -Wunmatched_returns

The issue may be something else, like options that are parsed by erl eval, but the error reporting is definitely wrong. I am using the following variable definitions in my Makefile:

ERLC_OPTS      := +debug_info +\"{cover_enabled,true}\" 
TEST_ERLC_OPTS := +debug_info +\"{cover_enabled,true}\" -I include -I test/ananke

CT_OPTS   := -cover test/ananke.coverspec
CT_SUITES := tekmar_store

DIALYZER_OPTS := -I include -Werror_handling -Wrace_conditions -Wunmatched_returns

This is on Mac OS X.

essen commented 8 years ago

Curious. I'll try to reproduce, thanks.

essen commented 8 years ago

The solution is to switch the boot script from start_clean to no_dot_erlang for some operations Erlang.mk does. I'm trying to see when this was introduced.

essen commented 8 years ago

It was introduced in R16B03. I'm not sure what to do about it yet.

I suppose we could look for the .erlang file and require R16B03+ when it exists.

An alternative could be to allow overriding the ERL variable to use no_dot_erlang when needed. I'm leaning toward this solution right now, considering few people seem to have run into this issue at this point.

essen commented 6 years ago

This will no longer be an issue in OTP 21 because of:

  OTP-14439    Application(s): compiler, dialyzer, erts, stdlib

               Changed the default behaviour of .erlang loading:
               .erlang is no longer loaded from the current directory.
               c:erlangrc(PathList) can be used to search and load an
               .erlang file from user specified directories.

               escript, erlc, dialyzer and typer no longer load an
               .erlang at all.

Closing, thanks!

essen commented 5 years ago

Enough time has passed, I am enabling no_dot_erlang by default now.