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

fix catching not_valid error on dialyzer #1279

Merged
merged 2 commits into from
Aug 1, 2016

Conversation

gbour
Copy link

@gbour gbour commented Jul 22, 2016

VERSION

$> ./rebar3 version
rebar 3.2.0 on Erlang/OTP 18 Erts 7.3.1

WHY
when running DEBUG=1 rebar3 dialyzer, I got following error:

...
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: {case_clause,{error,not_valid}}
===> Stack trace to the error location: [{rebar_prv_dialyzer,read_plt,
                                                 2,
                                                 [{file,
                                                   "/home/gbour/DEVEL/erlang-rebar3/_build/default/lib/rebar/src/rebar_prv_dialyzer.erl"},
                                                  {line,253}]},
                                                {rebar_prv_dialyzer,
                                                 update_base_plt,4,
                                                 [{file,
                                                   "/home/gbour/DEVEL/erlang-rebar3/_build/default/lib/rebar/src/rebar_prv_dialyzer.erl"},
                                                  {line,364}]},
...

the reason was $HOME/.cache/rebar3/rebar3_18.3.4.1_plt was empty.
dialyzer:plt_info() is returning {error, not_valid} tuple, which is not catched by rebar_prv_dialyzer:read_plt() function

HOW
this patch is simply catching previous error in read_plt() case matchlist, raising same exception as read_error

RESULT

$ ./rebar3 dialyzer
===> Verifying dependencies...
===> Compiling rebar
===> Dialyzer starting, this may take a while...
===> Updating plt...
===> Resolving files...
===> Updating base plt...
===> Resolving files...
===> Error in dialyzing apps: Could not read the PLT file "/home/gbour/.cache/rebar3/rebar3_18.3.4.1_plt"

@ferd
Copy link
Collaborator

ferd commented Jul 22, 2016

@fishcakez sounds good to me?

@fishcakez
Copy link
Contributor

the reason was $HOME/.cache/rebar3/rebar3_18.3.4.1_plt was empty.
dialyzer:plt_info() is returning {error, not_valid} tuple, which is not catched by rebar_prv_dialyzer:read_plt() function

If we get not_valid we can not recover because the PLT file can not be passed to binary_to_term. So I think we should try return error and overwrite the PLT.

@gbour
Copy link
Author

gbour commented Jul 31, 2016

this way ? (I checked and PLT is regenerated)

@fishcakez
Copy link
Contributor

👍

@talentdeficit talentdeficit merged commit f57102a into erlang:master Aug 1, 2016
@gbour gbour deleted the fix-dialyzer branch August 2, 2016 10:02
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

Successfully merging this pull request may close these issues.

4 participants