You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/11/20 07:17:59 UTC

[GitHub] [couchdb] nickva edited a comment on pull request #3837: erlfmt 3.x

nickva edited a comment on pull request #3837:
URL: https://github.com/apache/couchdb/pull/3837#issuecomment-974607093


   @kocolosk I attempted to check the beam files and it turns out they are not all exactly the same. The reason is that [fabric.hrl](https://github.com/apache/couchdb/blob/3.x/src/fabric/include/fabric.hrl#L13) happens to include `eunit.hrl` which has [`?LINE`](https://github.com/erlang/otp/blob/maint-24/lib/eunit/include/eunit.hrl#L134) macros embedded it it. As a consequence, anything that imports `fabric.hrl` and has any tests or asserts in the module ends up generating a different hash. Otherwise all the beam hashes match exactly.
   
   Here is how I checked:
   
   ```
   make clean && ERL_COMPILER_OPTIONS='[no_line_info,deterministic,no_debug_info]' make
   find ./src -name "*.beam" | parallel -q erl +S1:1 +A1 -eval '{ok, Info} = beam_lib:md5("{.}"), erlang:display(Info), halt().' -noshell | sort > ~/before.txt
   
   make erlfmt-format
   
   make clean && ERL_COMPILER_OPTIONS='[no_line_info,deterministic,no_debug_info]' make
   find ./src -name "*.beam" | parallel -q erl +S1:1 +A1 -eval '{ok, Info} = beam_lib:md5("{.}"), erlang:display(Info), halt().' -noshell | sort > ~/after.txt
   ```
   
   Then `diff ~/before.txt ~/after.txt` shows:
   ```diff 
   211,225c211,225
   < {cpse_test_attachments,<<32,25,9,124,163,35,187,202,214,210,132,184,163,74,73,179>>}
   < {cpse_test_compaction,<<101,38,195,12,75,77,87,202,240,161,250,204,110,248,71,110>>}
   < {cpse_test_copy_purge_infos,<<47,127,243,223,2,79,166,154,38,200,87,73,116,194,225,64>>}
   < {cpse_test_fold_changes,<<50,197,124,89,224,4,46,5,220,248,55,144,28,64,115,40>>}
   < {cpse_test_fold_docs,<<43,60,200,217,126,54,125,85,162,221,11,134,197,102,105,48>>}
   < {cpse_test_fold_purge_infos,<<27,194,58,15,217,95,193,128,174,34,222,230,171,138,1,166>>}
   < {cpse_test_get_set_props,<<112,179,149,148,59,229,78,8,57,90,6,254,135,141,155,223>>}
   < {cpse_test_open_close_delete,<<56,46,53,79,167,150,52,50,121,22,253,236,254,117,61,108>>}
   < {cpse_test_purge_bad_checkpoints,<<50,24,237,11,77,41,219,104,115,20,140,216,63,209,245,101>>}
   < {cpse_test_purge_docs,<<197,118,14,250,243,246,117,39,227,38,47,60,249,200,123,185>>}
   < {cpse_test_purge_replication,<<223,251,88,45,48,30,11,246,107,208,206,132,40,140,57,61>>}
   < {cpse_test_purge_seqs,<<185,199,181,60,122,56,35,149,82,12,89,236,18,181,38,253>>}
   < {cpse_test_read_write_docs,<<177,72,164,208,250,26,228,146,66,202,136,59,101,192,9,38>>}
   < {cpse_test_ref_counting,<<99,159,178,93,97,204,157,40,240,232,145,251,230,252,87,150>>}
   < {cpse_util,<<62,62,80,119,85,172,94,254,219,213,178,74,119,128,199,43>>}
   ---
   > {cpse_test_attachments,<<126,232,228,57,83,74,64,233,206,238,197,92,38,36,2,1>>}
   > {cpse_test_compaction,<<120,143,229,186,93,62,31,175,56,76,170,116,218,223,96,5>>}
   > {cpse_test_copy_purge_infos,<<77,30,72,91,121,124,168,20,93,4,105,187,240,217,190,174>>}
   > {cpse_test_fold_changes,<<3,108,121,119,83,17,222,32,197,85,32,204,205,81,178,23>>}
   > {cpse_test_fold_docs,<<118,84,177,166,58,160,95,220,240,157,94,221,215,109,230,48>>}
   > {cpse_test_fold_purge_infos,<<143,11,107,83,251,39,129,20,52,14,62,235,195,118,187,198>>}
   > {cpse_test_get_set_props,<<234,30,106,58,164,155,27,78,182,186,177,208,199,35,128,186>>}
   > {cpse_test_open_close_delete,<<212,234,80,114,157,128,44,18,231,119,82,67,224,103,80,6>>}
   > {cpse_test_purge_bad_checkpoints,<<137,70,133,250,183,96,32,45,98,109,142,216,224,55,197,91>>}
   > {cpse_test_purge_docs,<<161,242,247,131,118,90,73,16,43,150,168,3,212,142,201,30>>}
   > {cpse_test_purge_replication,<<123,72,165,230,201,72,166,172,37,201,164,150,124,97,0,160>>}
   > {cpse_test_purge_seqs,<<148,206,102,200,218,77,245,77,189,219,112,213,44,51,33,199>>}
   > {cpse_test_read_write_docs,<<63,211,165,162,90,48,69,68,147,29,99,186,186,94,150,45>>}
   > {cpse_test_ref_counting,<<28,125,106,219,193,25,93,115,38,106,105,130,102,124,141,120>>}
   > {cpse_util,<<228,93,86,105,243,80,163,86,156,29,35,141,233,120,255,222>>}
   303,304c303,304
   < {fabric,<<198,135,105,254,155,119,170,7,189,215,95,10,198,189,123,160>>}
   < {fabric_db_create,<<30,226,125,178,189,5,218,6,200,201,143,231,191,40,132,220>>}
   ---
   > {fabric,<<182,220,172,113,43,215,10,148,206,39,232,193,79,128,61,160>>}
   > {fabric_db_create,<<171,147,236,248,95,151,72,232,130,188,208,177,113,3,102,231>>}
   307c307
   < {fabric_db_info,<<31,123,22,228,209,80,156,92,111,21,202,24,142,216,64,240>>}
   ---
   > {fabric_db_info,<<36,250,28,75,15,76,117,205,183,31,212,6,15,54,166,186>>}
   309c309
   < {fabric_db_partition_info,<<217,143,193,150,227,47,198,222,102,225,65,69,118,213,60,134>>}
   ---
   > {fabric_db_partition_info,<<40,134,182,95,239,145,159,84,255,99,224,225,37,225,179,15>>}
   316,319c316,319
   < {fabric_doc_open,<<167,136,23,172,20,251,183,23,175,87,36,59,176,177,14,50>>}
   < {fabric_doc_open_revs,<<117,180,50,153,92,86,177,248,156,26,190,204,170,3,19,173>>}
   < {fabric_doc_purge,<<231,170,167,45,16,38,152,35,110,194,94,18,242,215,65,158>>}
   < {fabric_doc_update,<<200,239,189,239,234,73,166,177,117,196,55,130,62,155,71,75>>}
   ---
   > {fabric_doc_open,<<184,48,88,22,71,179,139,160,22,250,175,42,175,134,9,91>>}
   > {fabric_doc_open_revs,<<6,65,83,254,170,173,222,94,65,194,33,215,228,150,11,134>>}
   > {fabric_doc_purge,<<149,201,86,61,190,213,179,201,237,217,164,31,38,225,206,71>>}
   > {fabric_doc_update,<<243,242,251,177,118,38,231,95,16,17,193,247,28,217,158,183>>}
   321,325c321,325
   < {fabric_ring,<<171,181,76,126,121,155,222,2,231,130,48,71,240,124,168,162>>}
   < {fabric_rpc,<<184,167,56,17,99,212,167,217,68,97,252,26,137,78,212,95>>}
   < {fabric_streams,<<24,71,21,17,245,180,171,97,12,235,63,122,2,7,107,102>>}
   < {fabric_util,<<63,97,128,69,134,203,161,184,37,233,233,113,122,35,205,14>>}
   < {fabric_view,<<79,190,100,92,126,44,153,41,178,80,166,227,136,180,71,160>>}
   ---
   > {fabric_ring,<<208,24,56,143,160,164,124,146,198,153,243,158,42,145,203,111>>}
   > {fabric_rpc,<<119,18,139,252,114,13,65,73,101,236,42,135,152,103,82,111>>}
   > {fabric_streams,<<143,225,16,24,206,65,221,15,174,138,240,229,112,194,63,36>>}
   > {fabric_util,<<123,183,80,115,207,239,3,100,224,64,224,18,36,0,243,173>>}
   > {fabric_view,<<20,65,235,70,163,183,132,23,241,197,118,217,60,53,70,31>>}
   327c327
   < {fabric_view_changes,<<217,32,69,240,79,74,15,220,10,197,44,188,14,109,56,136>>}
   ---
   > {fabric_view_changes,<<216,98,16,160,120,27,130,203,45,113,217,245,41,247,5,142>>}
   403c403
   < {mango_cursor_view,<<235,43,150,186,111,132,93,87,21,233,238,51,190,149,182,130>>}
   ---
   > {mango_cursor_view,<<166,236,218,230,208,36,240,223,107,201,123,9,183,158,219,66>>}
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org