test suite failures because cmp behaves oddly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Does anyone know how 'cmp' can signal success when its output is redirected 
to /dev/null, even if the compared files are different?

$ cmp M.sum actual7.sum; echo $?
M.sum actual7.sum differ: char 20, line 2
1
$ cmp M.sum actual7.sum > /dev/null; echo $?
0
$ bash --version
GNU bash, version 3.1.17(1)-release (i586-suse-linux)
$ cmp --version
cmp (GNU diffutils) 2.8.7
[...]

Due to this behavior I see reproducible failures in the test suite, unless the 
tests are run in --verbose mode:

$ make GIT_TEST_OPTS=-i t1002-read-tree-m-u-2way.sh
*** t1002-read-tree-m-u-2way.sh ***
*   ok 1: setup
*   ok 2: 1, 2, 3 - no carry forward
*   ok 3: 4 - carry forward local addition.
*   ok 4: 5 - carry forward local addition.
*   ok 5: 6 - local addition already has the same.
* FAIL 6: 7 - local addition already has the same.
        rm -f .git/index nitfol bozbar rezrov frotz &&
             git-read-tree --reset -u $treeH &&
             echo frotz >frotz &&
             git-update-index --add frotz &&
             echo frotz frotz >frotz &&
             git-read-tree -m -u $treeH $treeM &&
             git-ls-files --stage >7.out &&
             diff -U0 M.out 7.out &&
             check_cache_at frotz dirty &&
             sum bozbar frotz nitfol >actual7.sum &&
             if cmp M.sum actual7.sum; then false; else :; fi &&
             : dirty index should have prevented -u from checking it out. &&
             echo frotz frotz >frotz1 &&
             diff frotz frotz1 &&
             rm -f frotz1
make: *** [t1002-read-tree-m-u-2way.sh] Error 1


Has anyone seen something like this?

-- Hannes
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]