[erlang-bugs] Dialyzer bug: incorrect duplicate modules

Max Bourinov <>
Thu Mar 21 11:10:00 CET 2013


Montenegro Erlang Hackaton was great indeed!

Thank you for your patch Max!


Best regards,
Max



On Thu, Mar 21, 2013 at 10:40 AM, Evgeniy Khramtsov <>wrote:

> On 21.03.2013 16:40, Maxim Treskin wrote:
>
>> Hello
>>
>> At Montenegro Erlang Hackaton ( http://lanyrd.com/2013/herceg-**
>> novi-erlang-meetup/ <http://lanyrd.com/2013/herceg-novi-erlang-meetup/>, there were only two people, unfortunately ) we found incorrect behaviour
>> of Dialyzer.
>>
>> Our project erroneous had a duplicated modules with the same name, but
>> different content. When we check it with dialyzer it show me something like
>> that:
>>
>> Duplicate modules: [["/var/tmp/myproj/apps/**
>> myproj/ebin/psc_operate.beam",
>>                      "/var/tmp/myproj/deps/somedep/**
>> ebin/amp_common_utils.beam"]]
>>
>> Obviously it is not the same modules. So I had to search this bug and
>> find strange behaviour in dialyzer. Function lists:zip/2 called with two
>> list, where first is reversed list of modules as atom, and second is list
>> of filepaths for modules. And this list not always contains correspond
>> elements. Module with name some_module1 can be has filename like
>> abc_module55.beam. This is the cause of error.
>>
>> This bug exists in R15B02 and R16.
>>
>> I wrote such patch to fix bug, but I don't know whether this is solution
>> or not, though it works fine.
>>
>> --- /opt/r16a/lib/dialyzer-2.5.4/**src/dialyzer_analysis_**callgraph.erl
>>    2013-01-31 12:55:53.210402846 +0700
>> +++ dialyzer_pa/dialyzer_analysis_**callgraph.erl 2013-03-21
>> 13:20:46.794991889 +0700
>> @@ -255,10 +255,18 @@
>>    CServer2 = dialyzer_codeserver:set_next_**core_label(NextLabel,
>> CServer),
>>    case Failed =:= [] of
>>      true ->
>> -      NewFiles = lists:zip(lists:reverse(**Modules), Files),
>> +      %% Modules and Files have not the same order, so it is meaningless
>> to zip it
>> +      %% NewFiles = lists:zip(lists:reverse(**Modules), Files),
>> +
>>        ModDict =
>> -        lists:foldl(fun({Mod, F}, Dict) -> dict:append(Mod, F, Dict) end,
>> -                    dict:new(), NewFiles),
>> +        lists:foldl(fun(F, Dict) ->
>> +                        ModFile = lists:last(filename:split(F)),
>> +                        Mod = filename:basename(ModFile, ".beam"),
>> +                        dict:append(Mod, F, Dict) end,
>> +                    dict:new(), Files),
>> +      %% ModDict =
>> +      %%   lists:foldl(fun({Mod, F}, Dict) -> dict:append(Mod, F, Dict)
>> end,
>> +      %%               dict:new(), NewFiles),
>>        check_for_duplicate_modules(**ModDict);
>>      false ->
>>        Msg = io_lib:format("Could not scan the following file(s): ~p",
>>
>
> I have the same problem. Thanks for the patch.
>
> --
> Regards,
> Evgeniy Khramtsov, ProcessOne.
> xmpp:
>
> ______________________________**_________________
> erlang-bugs mailing list
> 
> http://erlang.org/mailman/**listinfo/erlang-bugs<http://erlang.org/mailman/listinfo/erlang-bugs>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20130321/41741aca/attachment.html>


More information about the erlang-bugs mailing list