You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wi...@apache.org on 2019/12/02 08:13:45 UTC

[couchdb] branch couch_hash_update updated (0730f12 -> bcf6881)

This is an automated email from the ASF dual-hosted git repository.

willholley pushed a change to branch couch_hash_update
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


 discard 0730f12  Update usage of couch_hash:md5 shim
     new bcf6881  Update usage of couch_hash:md5_hash shim

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (0730f12)
            \
             N -- N -- N   refs/heads/couch_hash_update (bcf6881)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[couchdb] 01/01: Update usage of couch_hash:md5_hash shim

Posted by wi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

willholley pushed a commit to branch couch_hash_update
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit bcf6881e4a244bb7ec3326cc051fe45c586e35e6
Author: Will Holley <wi...@gmail.com>
AuthorDate: Mon Dec 2 08:01:57 2019 +0000

    Update usage of couch_hash:md5_hash shim
    
    https://github.com/apache/couchdb/pull/1445 introduced a shim to
    enable CouchDB to be compiled to use the Erlang MD5 function.
    This allows CouchDB to run in FIPS environments where the crypto
    module is restricted such that `crypto:hash(md5,..)` is blocked
    (fails with `notsup` error).
    
    This commit replaces usage of `crypto:hash(md5, ..)` introduced since
    the original PR with the shim function.
---
 src/couch_mrview/test/eunit/couch_mrview_purge_docs_tests.erl | 2 +-
 src/couch_pse_tests/src/cpse_test_purge_docs.erl              | 4 ++--
 src/couch_pse_tests/src/cpse_test_purge_seqs.erl              | 2 +-
 src/couch_pse_tests/src/cpse_util.erl                         | 4 ++--
 src/dreyfus/src/dreyfus_index.erl                             | 4 ++--
 src/fabric/test/eunit/fabric_rpc_purge_tests.erl              | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/couch_mrview/test/eunit/couch_mrview_purge_docs_tests.erl b/src/couch_mrview/test/eunit/couch_mrview_purge_docs_tests.erl
index 1020607..62e1410 100644
--- a/src/couch_mrview/test/eunit/couch_mrview_purge_docs_tests.erl
+++ b/src/couch_mrview/test/eunit/couch_mrview_purge_docs_tests.erl
@@ -139,7 +139,7 @@ test_purge_partial(Db) ->
         FDI1 = couch_db:get_full_doc_info(Db, <<"1">>), Rev1 = get_rev(FDI1),
         Update = {[
             {'_id', <<"1">>},
-            {'_rev', couch_doc:rev_to_str({1, [crypto:hash(md5, <<"1.2">>)]})},
+            {'_rev', couch_doc:rev_to_str({1, [couch_hash:md5_hash(<<"1.2">>)]})},
             {'val', 1.2}
         ]},
         {ok, [_Rev2]} = save_docs(Db, [Update], [replicated_changes]),
diff --git a/src/couch_pse_tests/src/cpse_test_purge_docs.erl b/src/couch_pse_tests/src/cpse_test_purge_docs.erl
index 1788eec..60a072d 100644
--- a/src/couch_pse_tests/src/cpse_test_purge_docs.erl
+++ b/src/couch_pse_tests/src/cpse_test_purge_docs.erl
@@ -253,7 +253,7 @@ cpse_purge_partial_revs(DbName) ->
     {ok, Rev1} = cpse_util:save_doc(DbName, {[{'_id', foo}, {vsn, <<"1.1">>}]}),
     Update = {[
         {'_id', foo},
-        {'_rev', couch_doc:rev_to_str({1, [crypto:hash(md5, <<"1.2">>)]})},
+        {'_rev', couch_doc:rev_to_str({1, [couch_hash:md5_hash(<<"1.2">>)]})},
         {vsn, <<"1.2">>}
     ]},
     {ok, [_Rev2]} = cpse_util:save_docs(DbName, [Update], [replicated_changes]),
@@ -392,7 +392,7 @@ cpse_purge_repeated_revisions(DbName) ->
     {ok, Rev1} = cpse_util:save_doc(DbName, {[{'_id', foo}, {vsn, <<"1.1">>}]}),
     Update = {[
         {'_id', foo},
-        {'_rev', couch_doc:rev_to_str({1, [crypto:hash(md5, <<"1.2">>)]})},
+        {'_rev', couch_doc:rev_to_str({1, [couch_hash:md5_hash(<<"1.2">>)]})},
         {vsn, <<"1.2">>}
     ]},
     {ok, [Rev2]} = cpse_util:save_docs(DbName, [Update], [replicated_changes]),
diff --git a/src/couch_pse_tests/src/cpse_test_purge_seqs.erl b/src/couch_pse_tests/src/cpse_test_purge_seqs.erl
index f363b76..c896b61 100644
--- a/src/couch_pse_tests/src/cpse_test_purge_seqs.erl
+++ b/src/couch_pse_tests/src/cpse_test_purge_seqs.erl
@@ -101,7 +101,7 @@ cpse_increment_purge_seq_on_partial_purge(DbName) ->
     {ok, Rev1} = cpse_util:save_doc(DbName, {[{'_id', foo1}, {vsn, <<"1.1">>}]}),
     Update = {[
         {'_id', foo1},
-        {'_rev', couch_doc:rev_to_str({1, [crypto:hash(md5, <<"1.2">>)]})},
+        {'_rev', couch_doc:rev_to_str({1, [couch_hash:md5_hash(<<"1.2">>)]})},
         {vsn, <<"1.2">>}
     ]},
     {ok, [_Rev2]} = cpse_util:save_docs(DbName, [Update], [replicated_changes]),
diff --git a/src/couch_pse_tests/src/cpse_util.erl b/src/couch_pse_tests/src/cpse_util.erl
index f8f6a19..24f49e8 100644
--- a/src/couch_pse_tests/src/cpse_util.erl
+++ b/src/couch_pse_tests/src/cpse_util.erl
@@ -371,11 +371,11 @@ gen_write(Db, {Action, {DocId, Body, Atts}}) ->
 
 
 gen_rev(A, DocId, {Pos, Rev}, Body, Atts) when A == update; A == delete ->
-    NewRev = crypto:hash(md5, term_to_binary({DocId, Rev, Body, Atts})),
+    NewRev = couch_hash:md5_hash(term_to_binary({DocId, Rev, Body, Atts})),
     {Pos + 1, [NewRev, Rev]};
 gen_rev(conflict, DocId, _, Body, Atts) ->
     UUID = couch_uuids:random(),
-    NewRev = crypto:hash(md5, term_to_binary({DocId, UUID, Body, Atts})),
+    NewRev = couch_hash:md5_hash(term_to_binary({DocId, UUID, Body, Atts})),
     {1, [NewRev]}.
 
 
diff --git a/src/dreyfus/src/dreyfus_index.erl b/src/dreyfus/src/dreyfus_index.erl
index e33a208..2bf560f 100644
--- a/src/dreyfus/src/dreyfus_index.erl
+++ b/src/dreyfus/src/dreyfus_index.erl
@@ -197,7 +197,7 @@ handle_info({'EXIT', FromPid, {updated, NewSeq}},
                 nil;
             false ->
                 spawn_link(fun() ->
-                    dreyfus_index_updater:update(IndexPid, Index) 
+                    dreyfus_index_updater:update(IndexPid, Index)
                 end)
         end,
         {noreply, State#state{index=Index,
@@ -274,7 +274,7 @@ design_doc_to_index(#doc{id=Id,body={Fields}}, IndexName) ->
                 undefined ->
                     {error, InvalidDDocError};
                 Def ->
-                    Sig = ?l2b(couch_util:to_hex(crypto:hash(md5,
+                    Sig = ?l2b(couch_util:to_hex(couch_hash:md5_hash(
                         term_to_binary({Analyzer, Def})))),
                     {ok, #index{
                         analyzer=Analyzer,
diff --git a/src/fabric/test/eunit/fabric_rpc_purge_tests.erl b/src/fabric/test/eunit/fabric_rpc_purge_tests.erl
index 4eafb2b..6db6a70 100644
--- a/src/fabric/test/eunit/fabric_rpc_purge_tests.erl
+++ b/src/fabric/test/eunit/fabric_rpc_purge_tests.erl
@@ -241,7 +241,7 @@ create_update(Doc, NewVsn) ->
         body = {Props}
     } = Doc,
     NewProps = lists:keyreplace(<<"vsn">>, 1, Props, {<<"vsn">>, NewVsn}),
-    NewRev = crypto:hash(md5, term_to_binary({DocId, Rev, {NewProps}})),
+    NewRev = couch_hash:md5_hash(term_to_binary({DocId, Rev, {NewProps}})),
     Doc#doc{
         revs = {Pos + 1, [NewRev | Revs]},
         body = {NewProps}