[erlang-bugs] mnesia_loader:db_match_erase/2 can only badmatch with dets

Paul Mineiro paul-trapexit@REDACTED
Sun Jul 20 23:23:17 CEST 2008


The return value of dets:match_delete/2 is an integer, or an error tuple;
mnesia_loader is matching against ok.

Attached is a suggested patch.

-- p

p.z. I wonder if the dialyzer would have found this ...
-------------- next part --------------
--- /Users/pmineiro/src/otp_src_R12B-2/lib/mnesia/src/mnesia_loader.erl.orig	2008-07-20 14:17:25.000000000 -0700
+++ mnesia_loader.erl	2008-07-20 14:20:24.000000000 -0700
@@ -620,7 +620,9 @@
 db_match_erase({disc_copies, Tab} , Pat) ->
     true = ?ets_match_delete(Tab, Pat);
 db_match_erase({disc_only_copies, Tab}, Pat) ->
-    ok = dets:match_delete(Tab, Pat).
+    case dets:match_delete(Tab, Pat) of
+      N when is_integer (N) -> true
+    end.
 
 db_put({ram_copies, Tab}, Val) ->
     true = ?ets_insert(Tab, Val);


More information about the erlang-bugs mailing list