A new user interface for you! Read more...

File dializer-relax-check-plt.patch of Package erlang

diff -Ndurp otp_src_20.2.4/lib/dialyzer/src/dialyzer_plt.erl otp_src_20.2.4-dializer-relax-check-plt/lib/dialyzer/src/dialyzer_plt.erl
--- otp_src_20.2.4/lib/dialyzer/src/dialyzer_plt.erl	2018-02-26 22:09:03.000000000 +0200
+++ otp_src_20.2.4-dializer-relax-check-plt/lib/dialyzer/src/dialyzer_plt.erl	2018-02-26 22:18:47.000000000 +0200
@@ -324,12 +324,7 @@ included_files1(FileName) ->
       Error
   end.
 
-check_version(#file_plt{version = ?VSN, implementation_md5 = ImplMd5}) ->
-  case compute_new_md5(ImplMd5, [], []) of
-    ok -> ok;
-    {differ, _, _} -> error;
-    {error, _} -> error
-  end;
+check_version(#file_plt{version = ?VSN}) -> ok;
 check_version(#file_plt{}) -> error.
 
 get_record_from_file(FileName) ->
@@ -474,15 +469,16 @@ check_plt(FileName, RemoveFiles, AddFile
 check_plt1(FileName, RemoveFiles, AddFiles) ->
   case get_record_from_file(FileName) of
     {ok, #file_plt{file_md5_list = Md5, mod_deps = ModDeps} = Rec} ->
+      Md5Res = compute_new_md5(Md5, RemoveFiles, AddFiles),
       case check_version(Rec) of
 	ok ->
-	  case compute_new_md5(Md5, RemoveFiles, AddFiles) of
+	  case Md5Res of
 	    ok -> ok;
 	    {differ, NewMd5, DiffMd5} -> {differ, NewMd5, DiffMd5, ModDeps};
 	    {error, _What} = Err -> Err
 	  end;
 	error ->
-	  case compute_new_md5(Md5, RemoveFiles, AddFiles) of
+	  case Md5Res of
 	    ok -> {old_version, Md5};
 	    {differ, NewMd5, _DiffMd5} -> {old_version, NewMd5};
 	    {error, _What} = Err -> Err
@@ -531,19 +527,9 @@ compute_md5_from_files(Files) ->
   lists:keysort(1, [{F, compute_md5_from_file(F)} || F <- Files]).
 
 compute_md5_from_file(File) ->
-  case beam_lib:all_chunks(File) of
-    {ok, _, Chunks} ->
-      %% We cannot use beam_lib:md5 because it does not consider
-      %% the debug_info chunk, where typespecs are likely stored.
-      %% So we consider almost all chunks except the useless ones.
-      Filtered = [[ID, Chunk] || {ID, Chunk} <- Chunks, ID =/= "CInf", ID =/= "Docs"],
-      erlang:md5(lists:sort(Filtered));
-    {error, beam_lib, {file_error, _, enoent}} ->
-      Msg = io_lib:format("Not a regular file: ~ts\n", [File]),
-      throw({dialyzer_error, Msg});
-    {error, beam_lib, _} ->
-      Msg = io_lib:format("Could not compute MD5 for .beam: ~ts\n", [File]),
-      throw({dialyzer_error, Msg})
+  case beam_lib:md5(File) of
+      {ok, {_, MD5}} -> MD5;
+      E -> throw({dialyzer_error, beam_lib:format_error(E)})
   end.
 
 init_diff_list(RemoveFiles, AddFiles) ->