{"thread":{"id":"5179","subject":"[PATCH] Workaround for strange cmp bug","startedAt":"2006-08-09T10:24:06Z","lastAt":"2006-08-10T08:20:36Z","messageCount":5,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"25015","messageId":"Pine.LNX.4.63.0608091221550.1800@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5179","inReplyTo":null,"subject":"[PATCH] Workaround for strange cmp bug","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-08-09T10:24:06Z","receivedAt":"2006-08-09T10:24:06Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThe cmp(1) (cmp (GNU diffutils) 2.8.7) distributed with openSUSE 10.1 has\na subtle \"shortcoming\":\n\n\t$ echo a > a\n\t$ echo b > b\n\t$ cmp a b && echo nonono\n\ta b differ: char 1, line 1\n\t$ cmp a b >/dev/null && echo nonono\n\tnonono\n\t$ cmp -s a b >/dev/null && echo nonono\n\nSo, if cmp should _not_ be quiet, _and_ the output is redirected to\n/dev/null, it has a bogus exit value. Our test suite redirects to\n/dev/null, which triggers that bug. (Obviously, the tests pass when\nrunning with '-v', which made that a real bugger to debug.)\n\nSince we have all too many '&&' cascades in the test scripts, and you\nhave to run 'bash -x t*.sh' anyway, the output of cmp when running\nthe tests with '-v' is not too helpful. Therefore we can replace all\ncalls to cmp with 'cmp -s'.\n\nThis patch was produced by\n\n\t$ perl -i.bak -pe 's/cmp ([^-])/cmp -s $1/' t/*.sh\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n t/t1002-read-tree-m-u-2way.sh    |   32 +++++++++++++++---------------\n t/t1003-read-tree-prefix.sh      |    2 +-\n t/t1020-subdirectory.sh          |   16 ++++++++-------\n t/t1200-tutorial.sh              |   22 ++++++++++-----------\n t/t1300-repo-config.sh           |   40 +++++++++++++++++++-------------------\n t/t2101-update-index-reupdate.sh |   12 ++++++-----\n t/t3300-funny-names.sh           |    2 +-\n t/t4012-diff-binary.sh           |    4 ++--\n t/t4109-apply-multifrag.sh       |   12 ++++++-----\n t/t4110-apply-scan.sh            |    2 +-\n t/t5300-pack-object.sh           |   12 ++++++-----\n t/t5400-send-pack.sh             |    4 ++--\n t/t6021-merge-criss-cross.sh     |    2 +-\n t/t9101-git-svn-props.sh         |    2 +-\n t/t9105-git-svn-commit-diff.sh   |    2 +-\n 15 files changed, 83 insertions(+), 83 deletions(-)\n\ndiff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh\nindex da3c813..6be4ee2 100755\n--- a/t/t1002-read-tree-m-u-2way.sh\n+++ b/t/t1002-read-tree-m-u-2way.sh\n@@ -59,9 +59,9 @@ test_expect_success \\\n      git-read-tree --reset -u $treeH &&\n      git-read-tree -m -u $treeH $treeM &&\n      git-ls-files --stage >1-3.out &&\n-     cmp M.out 1-3.out &&\n+     cmp -s M.out 1-3.out &&\n      sum bozbar frotz nitfol >actual3.sum &&\n-     cmp M.sum actual3.sum &&\n+     cmp -s M.sum actual3.sum &&\n      check_cache_at bozbar clean &&\n      check_cache_at frotz clean &&\n      check_cache_at nitfol clean'\n@@ -79,7 +79,7 @@ test_expect_success \\\n      compare_change 4diff.out expected &&\n      check_cache_at yomin clean &&\n      sum bozbar frotz nitfol >actual4.sum &&\n-     cmp M.sum actual4.sum &&\n+     cmp -s M.sum actual4.sum &&\n      echo yomin >yomin1 &&\n      diff yomin yomin1 &&\n      rm -f yomin1'\n@@ -98,7 +98,7 @@ test_expect_success \\\n      compare_change 5diff.out expected &&\n      check_cache_at yomin dirty &&\n      sum bozbar frotz nitfol >actual5.sum &&\n-     cmp M.sum actual5.sum &&\n+     cmp -s M.sum actual5.sum &&\n      : dirty index should have prevented -u from checking it out. &&\n      echo yomin yomin >yomin1 &&\n      diff yomin yomin1 &&\n@@ -115,7 +115,7 @@ test_expect_success \\\n      diff -U0 M.out 6.out &&\n      check_cache_at frotz clean &&\n      sum bozbar frotz nitfol >actual3.sum &&\n-     cmp M.sum actual3.sum &&\n+     cmp -s M.sum actual3.sum &&\n      echo frotz >frotz1 &&\n      diff frotz frotz1 &&\n      rm -f frotz1'\n@@ -132,7 +132,7 @@ test_expect_success \\\n      diff -U0 M.out 7.out &&\n      check_cache_at frotz dirty &&\n      sum bozbar frotz nitfol >actual7.sum &&\n-     if cmp M.sum actual7.sum; then false; else :; fi &&\n+     if cmp -s M.sum actual7.sum; then false; else :; fi &&\n      : dirty index should have prevented -u from checking it out. &&\n      echo frotz frotz >frotz1 &&\n      diff frotz frotz1 &&\n@@ -163,9 +163,9 @@ test_expect_success \\\n      git-update-index --add rezrov &&\n      git-read-tree -m -u $treeH $treeM &&\n      git-ls-files --stage >10.out &&\n-     cmp M.out 10.out &&\n+     cmp -s M.out 10.out &&\n      sum bozbar frotz nitfol >actual10.sum &&\n-     cmp M.sum actual10.sum'\n+     cmp -s M.sum actual10.sum'\n \n test_expect_success \\\n     '11 - dirty path removed.' \\\n@@ -210,9 +210,9 @@ test_expect_success \\\n      compare_change 14diff.out expected &&\n      sum bozbar frotz >actual14.sum &&\n      grep -v nitfol M.sum > expected14.sum &&\n-     cmp expected14.sum actual14.sum &&\n+     cmp -s expected14.sum actual14.sum &&\n      sum bozbar frotz nitfol >actual14a.sum &&\n-     if cmp M.sum actual14a.sum; then false; else :; fi &&\n+     if cmp -s M.sum actual14a.sum; then false; else :; fi &&\n      check_cache_at nitfol clean &&\n      echo nitfol nitfol >nitfol1 &&\n      diff nitfol nitfol1 &&\n@@ -232,9 +232,9 @@ test_expect_success \\\n      check_cache_at nitfol dirty &&\n      sum bozbar frotz >actual15.sum &&\n      grep -v nitfol M.sum > expected15.sum &&\n-     cmp expected15.sum actual15.sum &&\n+     cmp -s expected15.sum actual15.sum &&\n      sum bozbar frotz nitfol >actual15a.sum &&\n-     if cmp M.sum actual15a.sum; then false; else :; fi &&\n+     if cmp -s M.sum actual15a.sum; then false; else :; fi &&\n      echo nitfol nitfol nitfol >nitfol1 &&\n      diff nitfol nitfol1 &&\n      rm -f nitfol1'\n@@ -267,7 +267,7 @@ test_expect_success \\\n      diff -U0 M.out 18.out &&\n      check_cache_at bozbar clean &&\n      sum bozbar frotz nitfol >actual18.sum &&\n-     cmp M.sum actual18.sum'\n+     cmp -s M.sum actual18.sum'\n \n test_expect_success \\\n     '19 - local change already having a good result, further modified.' \\\n@@ -282,9 +282,9 @@ test_expect_success \\\n      check_cache_at bozbar dirty &&\n      sum frotz nitfol >actual19.sum &&\n      grep -v bozbar  M.sum > expected19.sum &&\n-     cmp expected19.sum actual19.sum &&\n+     cmp -s expected19.sum actual19.sum &&\n      sum bozbar frotz nitfol >actual19a.sum &&\n-     if cmp M.sum actual19a.sum; then false; else :; fi &&\n+     if cmp -s M.sum actual19a.sum; then false; else :; fi &&\n      echo gnusto gnusto >bozbar1 &&\n      diff bozbar bozbar1 &&\n      rm -f bozbar1'\n@@ -300,7 +300,7 @@ test_expect_success \\\n      diff -U0 M.out 20.out &&\n      check_cache_at bozbar clean &&\n      sum bozbar frotz nitfol >actual20.sum &&\n-     cmp M.sum actual20.sum'\n+     cmp -s M.sum actual20.sum'\n \n test_expect_success \\\n     '21 - no local change, dirty cache.' \\\ndiff --git a/t/t1003-read-tree-prefix.sh b/t/t1003-read-tree-prefix.sh\nindex 48ab117..a7156b2 100755\n--- a/t/t1003-read-tree-prefix.sh\n+++ b/t/t1003-read-tree-prefix.sh\n@@ -21,7 +21,7 @@ two/one' >expect\n test_expect_success 'read-tree --prefix' '\n \tgit-read-tree --prefix=two/ $tree &&\n \tgit-ls-files >actual &&\n-\tcmp expect actual\n+\tcmp -s expect actual\n '\n \n test_done\ndiff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh\nindex 4409b87..8bd4174 100755\n--- a/t/t1020-subdirectory.sh\n+++ b/t/t1020-subdirectory.sh\n@@ -46,10 +46,10 @@ test_expect_success 'cat-file' '\n \ttwo=`expr \"$two\" : \"[0-7]* \\\\([0-9a-f]*\\\\)\"` &&\n \techo \"$two\" &&\n \tgit-cat-file -p \"$two\" >actual &&\n-\tcmp dir/two actual &&\n+\tcmp -s dir/two actual &&\n \tcd dir &&\n \tgit-cat-file -p \"$two\" >actual &&\n-\tcmp two actual\n+\tcmp -s two actual\n '\n rm -f actual dir/actual\n \n@@ -86,10 +86,10 @@ test_expect_success 'write-tree' '\n test_expect_success 'checkout-index' '\n \tcd $HERE &&\n \tgit-checkout-index -f -u one &&\n-\tcmp one original.one &&\n+\tcmp -s one original.one &&\n \tcd dir &&\n \tgit-checkout-index -f -u two &&\n-\tcmp two ../original.two\n+\tcmp -s two ../original.two\n '\n \n test_expect_success 'read-tree' '\n@@ -97,13 +97,13 @@ test_expect_success 'read-tree' '\n \trm -f one dir/two &&\n \ttree=`git-write-tree` &&\n \tgit-read-tree --reset -u \"$tree\" &&\n-\tcmp one original.one &&\n-\tcmp dir/two original.two &&\n+\tcmp -s one original.one &&\n+\tcmp -s dir/two original.two &&\n \tcd dir &&\n \trm -f two &&\n \tgit-read-tree --reset -u \"$tree\" &&\n-\tcmp two ../original.two &&\n-\tcmp ../one ../original.one\n+\tcmp -s two ../original.two &&\n+\tcmp -s ../one ../original.one\n '\n \n test_done\ndiff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh\nindex c7db20e..2e2a898 100755\n--- a/t/t1200-tutorial.sh\n+++ b/t/t1200-tutorial.sh\n@@ -27,9 +27,9 @@ index 557db03..263414f 100644\n +It's a new day for git\n EOF\n git-diff-files -p > diff.output\n-test_expect_success 'git-diff-files -p' 'cmp diff.expect diff.output'\n+test_expect_success 'git-diff-files -p' 'cmp -s diff.expect diff.output'\n git diff > diff.output\n-test_expect_success 'git diff' 'cmp diff.expect diff.output'\n+test_expect_success 'git diff' 'cmp -s diff.expect diff.output'\n \n tree=$(git-write-tree 2>/dev/null)\n \n@@ -40,10 +40,10 @@ output=\"$(echo \"Initial commit\" | git-co\n test_expect_success 'commit' \"test 'Committing initial tree 8988da15d077d4829fc51d8544c097def6644dbb' = \\\"$output\\\"\"\n \n git-diff-index -p HEAD > diff.output\n-test_expect_success 'git-diff-index -p HEAD' 'cmp diff.expect diff.output'\n+test_expect_success 'git-diff-index -p HEAD' 'cmp -s diff.expect diff.output'\n \n git diff HEAD > diff.output\n-test_expect_success 'git diff HEAD' 'cmp diff.expect diff.output'\n+test_expect_success 'git diff HEAD' 'cmp -s diff.expect diff.output'\n \n #rm hello\n #test_expect_success 'git-read-tree --reset HEAD' \"git-read-tree --reset HEAD ; test \\\"hello: needs update\\\" = \\\"$(git-update-index --refresh)\\\"\"\n@@ -75,15 +75,15 @@ git-whatchanged -p --root | \\\n \tsed -e \"1s/^\\(.\\{7\\}\\).\\{40\\}/\\1VARIABLE/\" \\\n \t\t-e \"2,3s/^\\(.\\{8\\}\\).*$/\\1VARIABLE/\" \\\n > whatchanged.output\n-test_expect_success 'git-whatchanged -p --root' 'cmp whatchanged.expect whatchanged.output'\n+test_expect_success 'git-whatchanged -p --root' 'cmp -s whatchanged.expect whatchanged.output'\n \n git tag my-first-tag\n-test_expect_success 'git tag my-first-tag' 'cmp .git/refs/heads/master .git/refs/tags/my-first-tag'\n+test_expect_success 'git tag my-first-tag' 'cmp -s .git/refs/heads/master .git/refs/tags/my-first-tag'\n \n # TODO: test git-clone\n \n git checkout -b mybranch\n-test_expect_success 'git checkout -b mybranch' 'cmp .git/refs/heads/master .git/refs/heads/mybranch'\n+test_expect_success 'git checkout -b mybranch' 'cmp -s .git/refs/heads/master .git/refs/heads/mybranch'\n \n cat > branch.expect <<EOF\n   master\n@@ -91,7 +91,7 @@ cat > branch.expect <<EOF\n EOF\n \n git branch > branch.output\n-test_expect_success 'git branch' 'cmp branch.expect branch.output'\n+test_expect_success 'git branch' 'cmp -s branch.expect branch.output'\n \n git checkout mybranch\n echo \"Work, work, work\" >>hello\n@@ -125,7 +125,7 @@ cat > show-branch.expect << EOF\n EOF\n \n git show-branch --topo-order master mybranch > show-branch.output\n-test_expect_success 'git show-branch' 'cmp show-branch.expect show-branch.output'\n+test_expect_success 'git show-branch' 'cmp -s show-branch.expect show-branch.output'\n \n git checkout mybranch\n \n@@ -138,7 +138,7 @@ EOF\n \n git resolve HEAD master \"Merge upstream changes.\" | \\\n \tsed -e \"1s/[0-9a-f]\\{40\\}/VARIABLE/g\" > resolve.output\n-test_expect_success 'git resolve' 'cmp resolve.expect resolve.output'\n+test_expect_success 'git resolve' 'cmp -s resolve.expect resolve.output'\n \n cat > show-branch2.expect << EOF\n ! [master] Merged \"mybranch\" changes.\n@@ -148,7 +148,7 @@ cat > show-branch2.expect << EOF\n EOF\n \n git show-branch --topo-order master mybranch > show-branch2.output\n-test_expect_success 'git show-branch' 'cmp show-branch2.expect show-branch2.output'\n+test_expect_success 'git show-branch' 'cmp -s show-branch2.expect show-branch2.output'\n \n # TODO: test git fetch\n \ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex 0de2497..5af856d 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -16,7 +16,7 @@ cat > expect << EOF\n \tpenguin = little blue\n EOF\n \n-test_expect_success 'initial' 'cmp .git/config expect'\n+test_expect_success 'initial' 'cmp -s .git/config expect'\n \n git-repo-config Core.Movie BadPhysics\n \n@@ -26,7 +26,7 @@ cat > expect << EOF\n \tMovie = BadPhysics\n EOF\n \n-test_expect_success 'mixed case' 'cmp .git/config expect'\n+test_expect_success 'mixed case' 'cmp -s .git/config expect'\n \n git-repo-config Cores.WhatEver Second\n \n@@ -38,7 +38,7 @@ cat > expect << EOF\n \tWhatEver = Second\n EOF\n \n-test_expect_success 'similar section' 'cmp .git/config expect'\n+test_expect_success 'similar section' 'cmp -s .git/config expect'\n \n git-repo-config CORE.UPPERCASE true\n \n@@ -51,7 +51,7 @@ cat > expect << EOF\n \tWhatEver = Second\n EOF\n \n-test_expect_success 'similar section' 'cmp .git/config expect'\n+test_expect_success 'similar section' 'cmp -s .git/config expect'\n \n test_expect_success 'replace with non-match' \\\n \t'git-repo-config core.penguin kingpin !blue'\n@@ -69,7 +69,7 @@ cat > expect << EOF\n \tWhatEver = Second\n EOF\n \n-test_expect_success 'non-match result' 'cmp .git/config expect'\n+test_expect_success 'non-match result' 'cmp -s .git/config expect'\n \n cat > .git/config << EOF\n [beta] ; silly comment # another comment\n@@ -97,7 +97,7 @@ # empty line\n [nextSection] noNewline = ouch\n EOF\n \n-test_expect_success 'multiple unset is correct' 'cmp .git/config expect'\n+test_expect_success 'multiple unset is correct' 'cmp -s .git/config expect'\n \n mv .git/config2 .git/config\n \n@@ -114,7 +114,7 @@ # empty line\n [nextSection] noNewline = ouch\n EOF\n \n-test_expect_success 'all replaced' 'cmp .git/config expect'\n+test_expect_success 'all replaced' 'cmp -s .git/config expect'\n \n git-repo-config beta.haha alpha\n \n@@ -128,7 +128,7 @@ # empty line\n [nextSection] noNewline = ouch\n EOF\n \n-test_expect_success 'really mean test' 'cmp .git/config expect'\n+test_expect_success 'really mean test' 'cmp -s .git/config expect'\n \n git-repo-config nextsection.nonewline wow\n \n@@ -143,7 +143,7 @@ # empty line\n \tnonewline = wow\n EOF\n \n-test_expect_success 'really really mean test' 'cmp .git/config expect'\n+test_expect_success 'really really mean test' 'cmp -s .git/config expect'\n \n test_expect_success 'get value' 'test alpha = $(git-repo-config beta.haha)'\n git-repo-config --unset beta.haha\n@@ -158,7 +158,7 @@ # empty line\n \tnonewline = wow\n EOF\n \n-test_expect_success 'unset' 'cmp .git/config expect'\n+test_expect_success 'unset' 'cmp -s .git/config expect'\n \n git-repo-config nextsection.NoNewLine \"wow2 for me\" \"for me$\"\n \n@@ -173,7 +173,7 @@ # empty line\n \tNoNewLine = wow2 for me\n EOF\n \n-test_expect_success 'multivar' 'cmp .git/config expect'\n+test_expect_success 'multivar' 'cmp -s .git/config expect'\n \n test_expect_success 'non-match' \\\n \t'git-repo-config --get nextsection.nonewline !for'\n@@ -200,7 +200,7 @@ # empty line\n \tNoNewLine = wow2 for me\n EOF\n \n-test_expect_success 'multivar replace' 'cmp .git/config expect'\n+test_expect_success 'multivar replace' 'cmp -s .git/config expect'\n \n test_expect_failure 'ambiguous value' 'git-repo-config nextsection.nonewline'\n \n@@ -222,7 +222,7 @@ # empty line\n \tNoNewLine = wow2 for me\n EOF\n \n-test_expect_success 'multivar unset' 'cmp .git/config expect'\n+test_expect_success 'multivar unset' 'cmp -s .git/config expect'\n \n test_expect_failure 'invalid key' 'git-repo-config inval.2key blabla'\n \n@@ -245,7 +245,7 @@ # empty line\n \tAlpha = beta\n EOF\n \n-test_expect_success 'hierarchical section value' 'cmp .git/config expect'\n+test_expect_success 'hierarchical section value' 'cmp -s .git/config expect'\n \n cat > expect << EOF\n beta.noindent=sillyValue\n@@ -255,7 +255,7 @@ version.1.2.3eX.alpha=beta\n EOF\n \n test_expect_success 'working --list' \\\n-\t'git-repo-config --list > output && cmp output expect'\n+\t'git-repo-config --list > output && cmp -s output expect'\n \n cat > expect << EOF\n beta.noindent sillyValue\n@@ -263,7 +263,7 @@ nextsection.nonewline wow2 for me\n EOF\n \n test_expect_success '--get-regexp' \\\n-\t'git-repo-config --get-regexp in > output && cmp output expect'\n+\t'git-repo-config --get-regexp in > output && cmp -s output expect'\n \n cat > .git/config << EOF\n [novalue]\n@@ -292,7 +292,7 @@ cat > expect << EOF\n \tx = y\n EOF\n \n-test_expect_success 'new section is partial match of another' 'cmp .git/config expect'\n+test_expect_success 'new section is partial match of another' 'cmp -s .git/config expect'\n \n git-repo-config b.x y\n git-repo-config a.b c\n@@ -307,7 +307,7 @@ cat > expect << EOF\n \tx = y\n EOF\n \n-test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect'\n+test_expect_success 'new variable inserts into proper section' 'cmp -s .git/config expect'\n \n cat > other-config << EOF\n [ein]\n@@ -320,7 +320,7 @@ EOF\n \n GIT_CONFIG=other-config git-repo-config -l > output\n \n-test_expect_success 'alternative GIT_CONFIG' 'cmp output expect'\n+test_expect_success 'alternative GIT_CONFIG' 'cmp -s output expect'\n \n GIT_CONFIG=other-config git-repo-config anwohner.park ausweis\n \n@@ -331,7 +331,7 @@ cat > expect << EOF\n \tpark = ausweis\n EOF\n \n-test_expect_success '--set in alternative GIT_CONFIG' 'cmp other-config expect'\n+test_expect_success '--set in alternative GIT_CONFIG' 'cmp -s other-config expect'\n \n test_done\n \ndiff --git a/t/t2101-update-index-reupdate.sh b/t/t2101-update-index-reupdate.sh\nindex a78ea7f..bc452c4 100755\n--- a/t/t2101-update-index-reupdate.sh\n+++ b/t/t2101-update-index-reupdate.sh\n@@ -17,7 +17,7 @@ test_expect_success 'update-index --add'\n \t echo goodbye people >file2 &&\n \t git-update-index --add file1 file2 &&\n \t git-ls-files -s >current &&\n-\t cmp current expected'\n+\t cmp -s current expected'\n \n test_expect_success 'update-index --again' \\\n \t'rm -f file1 &&\n@@ -30,7 +30,7 @@ test_expect_success 'update-index --agai\n \t\techo happy - failed as expected\n \tfi &&\n \t git-ls-files -s >current &&\n-\t cmp current expected'\n+\t cmp -s current expected'\n \n cat > expected <<\\EOF\n 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0\tfile2\n@@ -38,7 +38,7 @@ EOF\n test_expect_success 'update-index --remove --again' \\\n \t'git-update-index --remove --again &&\n \t git-ls-files -s >current &&\n-\t cmp current expected'\n+\t cmp -s current expected'\n \n test_expect_success 'first commit' 'git-commit -m initial'\n \n@@ -55,7 +55,7 @@ test_expect_success 'update-index again'\n \techo happy >dir1/file3 &&\n \tgit-update-index --again &&\n \tgit-ls-files -s >current &&\n-\tcmp current expected'\n+\tcmp -s current expected'\n \n cat > expected <<\\EOF\n 100644 d7fb3f695f06c759dbf3ab00046e7cc2da22d10f 0\tdir1/file3\n@@ -68,7 +68,7 @@ test_expect_success 'update-index --upda\n \tgit-update-index --again &&\n \tcd .. &&\n \tgit-ls-files -s >current &&\n-\tcmp current expected'\n+\tcmp -s current expected'\n \n cat > expected <<\\EOF\n 100644 594fb5bb1759d90998e2bf2a38261ae8e243c760 0\tdir1/file3\n@@ -79,6 +79,6 @@ test_expect_success 'update-index --upda\n \tcat file2 >dir1/file3 &&\n \tgit-update-index --again dir1/ &&\n \tgit-ls-files -s >current &&\n-\tcmp current expected'\n+\tcmp -s current expected'\n \n test_done\ndiff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh\nindex c12270e..d2c1af8 100755\n--- a/t/t3300-funny-names.sh\n+++ b/t/t3300-funny-names.sh\n@@ -24,7 +24,7 @@ EOF\n cat >\"$p1\" \"$p0\"\n echo 'Foo Bar Baz' >\"$p2\"\n \n-test -f \"$p1\" && cmp \"$p0\" \"$p1\" || {\n+test -f \"$p1\" && cmp -s \"$p0\" \"$p1\" || {\n \t# since FAT/NTFS does not allow tabs in filenames, skip this test\n \tsay 'Your filesystem does not allow tabs in filenames, test skipped.'\n \ttest_done\ndiff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh\nindex 323606c..0ff3c4d 100755\n--- a/t/t4012-diff-binary.sh\n+++ b/t/t4012-diff-binary.sh\n@@ -25,11 +25,11 @@ cat > expected <<\\EOF\n EOF\n test_expect_success 'diff without --binary' \\\n \t'git-diff | git-apply --stat --summary >current &&\n-\t cmp current expected'\n+\t cmp -s current expected'\n \n test_expect_success 'diff with --binary' \\\n \t'git-diff --binary | git-apply --stat --summary >current &&\n-\t cmp current expected'\n+\t cmp -s current expected'\n \n # apply needs to be able to skip the binary material correctly\n # in order to report the line number of a corrupt patch.\ndiff --git a/t/t4109-apply-multifrag.sh b/t/t4109-apply-multifrag.sh\nindex 5988e1a..85ef40e 100755\n--- a/t/t4109-apply-multifrag.sh\n+++ b/t/t4109-apply-multifrag.sh\n@@ -145,8 +145,8 @@ mv main.c main.c.git\n test_expect_success \"S = patch (1)\" \\\n     'cat patch1.patch patch2.patch | patch -p1'\n \n-test_expect_success \"S = cmp (1)\" \\\n-    'cmp main.c.git main.c'\n+test_expect_success \"S = cmp -s (1)\" \\\n+    'cmp -s main.c.git main.c'\n \n rm -f main.c main.c.git\n \n@@ -157,8 +157,8 @@ mv main.c main.c.git\n test_expect_success \"S = patch (2)\" \\\n     'cat patch1.patch patch2.patch patch3.patch | patch -p1'\n \n-test_expect_success \"S = cmp (2)\" \\\n-    'cmp main.c.git main.c'\n+test_expect_success \"S = cmp -s (2)\" \\\n+    'cmp -s main.c.git main.c'\n \n rm -f main.c main.c.git\n \n@@ -169,8 +169,8 @@ mv main.c main.c.git\n test_expect_success \"S = patch (3)\" \\\n     'cat patch1.patch patch4.patch | patch -p1'\n \n-test_expect_success \"S = cmp (3)\" \\\n-    'cmp main.c.git main.c'\n+test_expect_success \"S = cmp -s (3)\" \\\n+    'cmp -s main.c.git main.c'\n \n test_done\n \ndiff --git a/t/t4110-apply-scan.sh b/t/t4110-apply-scan.sh\nindex 005f744..3c767a4 100755\n--- a/t/t4110-apply-scan.sh\n+++ b/t/t4110-apply-scan.sh\n@@ -95,7 +95,7 @@ test_expect_success \"S = patch scan\" \\\n mv new.txt patch.txt\n \n test_expect_success \"S = cmp\" \\\n-    'cmp apply.txt patch.txt'\n+    'cmp -s apply.txt patch.txt'\n \n test_done\n \ndiff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh\nindex de45ac4..5564162 100755\n--- a/t/t5300-pack-object.sh\n+++ b/t/t5300-pack-object.sh\n@@ -56,7 +56,7 @@ test_expect_success \\\n     '(cd ../.git && find objects -type f -print) |\n      while read path\n      do\n-         cmp $path ../.git/$path || {\n+         cmp -s $path ../.git/$path || {\n \t     echo $path differs.\n \t     return 1\n \t }\n@@ -86,7 +86,7 @@ test_expect_success \\\n     '(cd ../.git && find objects -type f -print) |\n      while read path\n      do\n-         cmp $path ../.git/$path || {\n+         cmp -s $path ../.git/$path || {\n \t     echo $path differs.\n \t     return 1\n \t }\n@@ -182,17 +182,17 @@ test_expect_success \\\n     'build pack index for an existing pack' \\\n     'cp test-1-${packname_1}.pack test-3.pack &&\n      git-index-pack -o tmp.idx test-3.pack &&\n-     cmp tmp.idx test-1-${packname_1}.idx &&\n+     cmp -s tmp.idx test-1-${packname_1}.idx &&\n \n      git-index-pack test-3.pack &&\n-     cmp test-3.idx test-1-${packname_1}.idx &&\n+     cmp -s test-3.idx test-1-${packname_1}.idx &&\n \n      cp test-2-${packname_2}.pack test-3.pack &&\n      git-index-pack -o tmp.idx test-2-${packname_2}.pack &&\n-     cmp tmp.idx test-2-${packname_2}.idx &&\n+     cmp -s tmp.idx test-2-${packname_2}.idx &&\n \n      git-index-pack test-3.pack &&\n-     cmp test-3.idx test-2-${packname_2}.idx &&\n+     cmp -s test-3.idx test-2-${packname_2}.idx &&\n \n      :'\n \ndiff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh\nindex f3694ac..cb32283 100755\n--- a/t/t5400-send-pack.sh\n+++ b/t/t5400-send-pack.sh\n@@ -52,7 +52,7 @@ test_expect_success \\\n \t\techo >&2 Thanks, it correctly failed.\n \t\ttrue\n \tfi &&\n-\tif cmp victim/.git/refs/heads/master .git/refs/heads/master\n+\tif cmp -s victim/.git/refs/heads/master .git/refs/heads/master\n \tthen\n \t\t# should have been left as it was!\n \t\tfalse\n@@ -61,7 +61,7 @@ test_expect_success \\\n \tfi &&\n \t# this should update\n \tgit-send-pack --force ./victim/.git/ master &&\n-\tcmp victim/.git/refs/heads/master .git/refs/heads/master\n+\tcmp -s victim/.git/refs/heads/master .git/refs/heads/master\n '\n \n test_done\ndiff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh\nindex 8f7366d..97e85b9 100755\n--- a/t/t6021-merge-criss-cross.sh\n+++ b/t/t6021-merge-criss-cross.sh\n@@ -93,6 +93,6 @@ cat > file-expect <<EOF\n 9\n EOF\n \n-test_expect_success 'Criss-cross merge result' 'cmp file file-expect'\n+test_expect_success 'Criss-cross merge result' 'cmp -s file file-expect'\n \n test_done\ndiff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh\nindex a5a235f..e19c3df 100755\n--- a/t/t9101-git-svn-props.sh\n+++ b/t/t9101-git-svn-props.sh\n@@ -97,7 +97,7 @@ test_expect_success 'fetch and pull late\n \n for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf\n do\n-\ttest_expect_success \"Comparing $i\" \"cmp $i new_wc/$i\"\n+\ttest_expect_success \"Comparing $i\" \"cmp -s $i new_wc/$i\"\n done\n \n \ndiff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh\nindex f994b72..315bdd3 100755\n--- a/t/t9105-git-svn-commit-diff.sh\n+++ b/t/t9105-git-svn-commit-diff.sh\n@@ -35,7 +35,7 @@ test_expect_success 'test the commit-dif\n \ttest -n '$prev' && test -n '$head' &&\n \tgit-svn commit-diff '$prev' '$head' '$svnrepo' &&\n \tsvn co $svnrepo wc &&\n-\tcmp readme wc/readme\n+\tcmp -s readme wc/readme\n \t\"\n \n test_done\n-- \n1.4.2.rc3.ge5673-dirty\n"},{"id":"25017","messageId":"7v3bc65gk0.fsf@assigned-by-dhcp.cox.net","threadId":"5179","inReplyTo":"Pine.LNX.4.63.0608091221550.1800@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Workaround for strange cmp bug","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-09T10:50:23Z","receivedAt":"2006-08-09T10:50:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> The cmp(1) (cmp (GNU diffutils) 2.8.7) distributed with openSUSE 10.1 has\n> a subtle \"shortcoming\":\n>\n> \t$ echo a > a\n> \t$ echo b > b\n> \t$ cmp a b && echo nonono\n> \ta b differ: char 1, line 1\n> \t$ cmp a b >/dev/null && echo nonono\n> \tnonono\n> \t$ cmp -s a b >/dev/null && echo nonono\n>\n> So, if cmp should _not_ be quiet, _and_ the output is redirected to\n> /dev/null, it has a bogus exit value. Our test suite redirects to\n> /dev/null, which triggers that bug. (Obviously, the tests pass when\n> running with '-v', which made that a real bugger to debug.)\n\nWhile I sympathize unfortunate users who are stuck with such a\nbroken implementation of an important basic tool, such a rewrite\nunnecessarily makes debugging of both test scripts _and_ real\nbreakage harder.\n\nIt actually is very useful, in the chain of &&, to see that\nthese steps in our tests output something when they shouldn't\nwhen the tests are run under -v; you may have noticed that the\ntests written by me have seemingly useless \"echo happy\" (which\nalways returns true) and such, and they are there for a reason.\n\nPlease get the distribution fixed.\n"},{"id":"25023","messageId":"Pine.LNX.4.63.0608091309590.1800@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5179","inReplyTo":"7v3bc65gk0.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Workaround for strange cmp bug","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-08-09T11:12:33Z","receivedAt":"2006-08-09T11:12:33Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 9 Aug 2006, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > The cmp(1) (cmp (GNU diffutils) 2.8.7) distributed with openSUSE 10.1 has\n> > a subtle \"shortcoming\":\n\nOkay, I will try to fix the distribution. I only thought it was worthwhile \nspreading the workaround for other poor souls.\n\n> It actually is very useful, in the chain of &&, to see that\n> these steps in our tests output something when they shouldn't\n> when the tests are run under -v; you may have noticed that the\n> tests written by me have seemingly useless \"echo happy\" (which\n> always returns true) and such, and they are there for a reason.\n\nWell, I found myself stuck with too many of hard-to-debug cascades, where \nthere is no \"echo happy\". I think that you are lost with most test \nscripts, if you do not use \"bash -x\".\n\nCiao,\nDscho\n"},{"id":"25030","messageId":"Pine.LNX.4.63.0608091540040.1800@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5179","inReplyTo":"Pine.LNX.4.63.0608091309590.1800@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Workaround for strange cmp bug","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-08-09T13:42:11Z","receivedAt":"2006-08-09T13:42:11Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 9 Aug 2006, Johannes Schindelin wrote:\n\n> On Wed, 9 Aug 2006, Junio C Hamano wrote:\n> \n> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > \n> > > [ a whole lot about the output of cmp when calling a test with -v ]\n\nThinking about it again, I remember replacing 'cmp' by 'diff -u' quite a \nfew times, because the output of the latter was even more helpful... And \nbesides, 'diff -u' is not broken in my setup ;-)\n\nCiao,\nDscho\n"},{"id":"25075","messageId":"Pine.LNX.4.63.0608101016590.13885@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5179","inReplyTo":"Pine.LNX.4.63.0608091309590.1800@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Workaround for strange cmp bug","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-08-10T08:20:36Z","receivedAt":"2006-08-10T08:20:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 9 Aug 2006, Johannes Schindelin wrote:\n\n> On Wed, 9 Aug 2006, Junio C Hamano wrote:\n> \n> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > \n> > > The cmp(1) (cmp (GNU diffutils) 2.8.7) distributed with openSUSE \n> > > 10.1 has a subtle \"shortcoming\":\n> \n> Okay, I will try to fix the distribution. I only thought it was worthwhile \n> spreading the workaround for other poor souls.\n\nGot it. The problem is that diffutils-2.8.7-15 and -18 (which seem to be \nthe same...) have cherry-picked a \"fix\" from CVS (cmp-eof-dev-null.diff), \nwhich is wrong. It was fixed in diffutils CVS, and I submitted a bug \nreport in openSUSEÂ's bugzilla.\n\nSo, look out for diffutils-2.8.7-15 on openSUSE (although it only breaks \nthe _tests_, not git itself!).\n\nCiao,\nDscho\n"}]}