{"thread":{"id":"37546","subject":"[PATCH] t9300: use cmp instead of test_cmp to compare binary files","startedAt":"2014-09-12T17:34:00Z","lastAt":"2014-09-12T19:47:34Z","messageCount":4,"participants":["Johannes Sixt","Junio C Hamano","Thomas Braun"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"249314","messageId":"54132E88.8050803@kdbg.org","threadId":"37546","inReplyTo":null,"subject":"[PATCH] t9300: use cmp instead of test_cmp to compare binary files","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2014-09-12T17:34:00Z","receivedAt":"2014-09-12T17:34:00Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"test_cmp is intended to produce diff output for human consumption. The\ninput in one instance in t9300-fast-import.sh are binary files, however.\nUse cmp to compare the files.\n\nThis was noticed because on Windows we have a special implementation of\ntest_cmp in pure bash code (to ignore differences due to intermittent CR\nin actual output), and bash runs into an infinite loop due to the binary\nnature of the input.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n t/t9300-fast-import.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 99f5161..4b13170 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -2687,7 +2687,7 @@ test_expect_success 'R: verify created pack' '\n test_expect_success \\\n \t'R: verify written objects' \\\n \t'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n-\t test_cmp expect actual &&\n+\t cmp expect actual &&\n \t a=$(git --git-dir=R/.git rev-parse big-file:big1) &&\n \t b=$(git --git-dir=R/.git rev-parse big-file:big2) &&\n \t test $a = $b'\n-- \n2.0.0.12.gbcf935e\n"},{"id":"249315","messageId":"xmqq1trgbu0p.fsf@gitster.dls.corp.google.com","threadId":"37546","inReplyTo":"54132E88.8050803@kdbg.org","subject":"Re: [PATCH] t9300: use cmp instead of test_cmp to compare binary files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-09-12T17:58:30Z","receivedAt":"2014-09-12T17:58:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> test_cmp is intended to produce diff output for human consumption. The\n> input in one instance in t9300-fast-import.sh are binary files, however.\n> Use cmp to compare the files.\n\nThanks.\n\n>\n> This was noticed because on Windows we have a special implementation of\n> test_cmp in pure bash code (to ignore differences due to intermittent CR\n> in actual output), and bash runs into an infinite loop due to the binary\n> nature of the input.\n>\n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n>  t/t9300-fast-import.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\n> index 99f5161..4b13170 100755\n> --- a/t/t9300-fast-import.sh\n> +++ b/t/t9300-fast-import.sh\n> @@ -2687,7 +2687,7 @@ test_expect_success 'R: verify created pack' '\n>  test_expect_success \\\n>  \t'R: verify written objects' \\\n>  \t'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n> -\t test_cmp expect actual &&\n> +\t cmp expect actual &&\n>  \t a=$(git --git-dir=R/.git rev-parse big-file:big1) &&\n>  \t b=$(git --git-dir=R/.git rev-parse big-file:big2) &&\n>  \t test $a = $b'\n"},{"id":"249318","messageId":"54133812.2050002@virtuell-zuhause.de","threadId":"37546","inReplyTo":"xmqq1trgbu0p.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] t9300: use cmp instead of test_cmp to compare binary files","fromName":"Thomas Braun","fromEmail":"thomas.braun@virtuell-zuhause.de","sentAt":"2014-09-12T18:14:42Z","receivedAt":"2014-09-12T18:14:42Z","isPatch":true,"sender":{"key":"thomas.braun@virtuell-zuhause.de","avatar":"https://avatars.githubusercontent.com/u/1185677?v=4"},"body":"Am 12.09.2014 um 19:58 schrieb Junio C Hamano:\n> Johannes Sixt <j6t@kdbg.org> writes:\n> \n>> test_cmp is intended to produce diff output for human consumption. The\n>> input in one instance in t9300-fast-import.sh are binary files, however.\n>> Use cmp to compare the files.\n> \n> Thanks.\n> \n>>\n>> This was noticed because on Windows we have a special implementation of\n>> test_cmp in pure bash code (to ignore differences due to intermittent CR\n>> in actual output), and bash runs into an infinite loop due to the binary\n>> nature of the input.\n>>\n>> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n>> ---\n>>  t/t9300-fast-import.sh | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\n>> index 99f5161..4b13170 100755\n>> --- a/t/t9300-fast-import.sh\n>> +++ b/t/t9300-fast-import.sh\n>> @@ -2687,7 +2687,7 @@ test_expect_success 'R: verify created pack' '\n>>  test_expect_success \\\n>>  \t'R: verify written objects' \\\n>>  \t'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n>> -\t test_cmp expect actual &&\n>> +\t cmp expect actual &&\n>>  \t a=$(git --git-dir=R/.git rev-parse big-file:big1) &&\n>>  \t b=$(git --git-dir=R/.git rev-parse big-file:big2) &&\n>>  \t test $a = $b'\n\nMay I suggest to use test_cmp_bin instead of plain cmp?\ntest_cmp_bin was introduced in\nb93e6e36 (t5000, t5003: do not use test_cmp to compare binary files,\n2014-06-04) and by default is plain cmp.\n"},{"id":"249329","messageId":"54134DD6.1040509@kdbg.org","threadId":"37546","inReplyTo":"54133812.2050002@virtuell-zuhause.de","subject":"[PATCH v2] t9300: use test_cmp_bin instead of test_cmp to compare binary files","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2014-09-12T19:47:34Z","receivedAt":"2014-09-12T19:47:34Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"test_cmp is intended to produce diff output for human consumption. The\ninput in one instance in t9300-fast-import.sh are binary files, however.\nUse test_cmp_bin to compare the files.\n\nThis was noticed because on Windows we have a special implementation of\ntest_cmp in pure bash code (to ignore differences due to intermittent CR\nin actual output), and bash runs into an infinite loop due to the binary\nnature of the input.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\nAm 12.09.2014 um 20:14 schrieb Thomas Braun:\n> May I suggest to use test_cmp_bin instead of plain cmp?\n\nOf course! I did remember that there was talk about it, but missed\nthat we actually implemented it. Sorry.\n\n t/t9300-fast-import.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 99f5161..72845f6 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -2687,7 +2687,7 @@ test_expect_success 'R: verify created pack' '\n test_expect_success \\\n \t'R: verify written objects' \\\n \t'git --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n-\t test_cmp expect actual &&\n+\t test_cmp_bin expect actual &&\n \t a=$(git --git-dir=R/.git rev-parse big-file:big1) &&\n \t b=$(git --git-dir=R/.git rev-parse big-file:big2) &&\n \t test $a = $b'\n-- \n2.0.0.12.gbcf935e\n"}]}