Permalink
Browse files

Merge branch 'jk/sha1dc'

The "detect attempt to create collisions" variant of SHA-1
implementation by Marc Stevens (CWI) and Dan Shumow (Microsoft)
has been integrated and made the default.

* jk/sha1dc:
  Makefile: make DC_SHA1 the default
  t0013: add a basic sha1 collision detection test
  Makefile: add DC_SHA1 knob
  sha1dc: disable safe_hash feature
  sha1dc: adjust header includes for git
  sha1dc: add collision-detecting sha1 implementation
  • Loading branch information...
gitster committed Mar 24, 2017
2 parents fa13fd1 + e6b07da commit 48b3693d3cec7bd7996b1394a8df901d1fc26320
Showing with 2,405 additions and 2 deletions.
  1. +17 −2 Makefile
  2. +2 −0 hash.h
  3. +30 −0 sha1dc/LICENSE.txt
  4. +1,808 −0 sha1dc/sha1.c
  5. +122 −0 sha1dc/sha1.h
  6. +363 −0 sha1dc/ubc_check.c
  7. +44 −0 sha1dc/ubc_check.h
  8. +19 −0 t/t0013-sha1dc.sh
  9. BIN t/t0013/shattered-1.pdf
View
@@ -140,6 +140,13 @@ all::
# Define PPC_SHA1 environment variable when running make to make use of
# a bundled SHA1 routine optimized for PowerPC.
#
# Define DC_SHA1 to unconditionally enable the collision-detecting sha1
# algorithm. This is slower, but may detect attempted collision attacks.
# Takes priority over other *_SHA1 knobs.
#
# Define OPENSSL_SHA1 environment variable when running make to link
# with the SHA1 routine from openssl library.
#
# Define SHA1_MAX_BLOCK_SIZE to limit the amount of data that will be hashed
# in one call to the platform's SHA1_Update(). e.g. APPLE_COMMON_CRYPTO
# wants 'SHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' defined.
@@ -1383,6 +1390,10 @@ ifdef APPLE_COMMON_CRYPTO
SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L
endif
ifdef OPENSSL_SHA1
EXTLIBS += $(LIB_4_CRYPTO)
BASIC_CFLAGS += -DSHA1_OPENSSL
else
ifdef BLK_SHA1
LIB_OBJS += block-sha1/sha1.o
BASIC_CFLAGS += -DSHA1_BLK
@@ -1395,8 +1406,11 @@ ifdef APPLE_COMMON_CRYPTO
COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
BASIC_CFLAGS += -DSHA1_APPLE
else
EXTLIBS += $(LIB_4_CRYPTO)
BASIC_CFLAGS += -DSHA1_OPENSSL
DC_SHA1 := YesPlease
LIB_OBJS += sha1dc/sha1.o
LIB_OBJS += sha1dc/ubc_check.o
BASIC_CFLAGS += -DSHA1_DC
endif
endif
endif
endif
@@ -2223,6 +2237,7 @@ GIT-BUILD-OPTIONS: FORCE
@echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
@echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
@echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
@echo DC_SHA1=\''$(subst ','\'',$(subst ','\'',$(DC_SHA1)))'\' >>$@+
ifdef TEST_OUTPUT_DIRECTORY
@echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
endif
View
2 hash.h
@@ -7,6 +7,8 @@
#include <CommonCrypto/CommonDigest.h>
#elif defined(SHA1_OPENSSL)
#include <openssl/sha.h>
#elif defined(SHA1_DC)
#include "sha1dc/sha1.h"
#else /* SHA1_BLK */
#include "block-sha1/sha1.h"
#endif
View
@@ -0,0 +1,30 @@
MIT License
Copyright (c) 2017:
Marc Stevens
Cryptology Group
Centrum Wiskunde & Informatica
P.O. Box 94079, 1090 GB Amsterdam, Netherlands
marc@marc-stevens.nl
Dan Shumow
Microsoft Research
danshu@microsoft.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Oops, something went wrong.

2 comments on commit 48b3693

@git-for-windows-ci

This comment has been minimized.

Show comment
Hide comment
@git-for-windows-ci

git-for-windows-ci Mar 27, 2017

The administrative script of Git for Windows identified a problem with this commit while running t0002-gitfile.sh:

make: Entering directory '/c/agent/_work/3/s/t'
*** t0002-gitfile.sh ***
Initialized empty Git repository in C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.git/
expecting success: 
	REAL="$(pwd)/.real" &&
	mv .git "$REAL"

+++ pwd
+++ builtin pwd -W
++ REAL='C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real'
++ mv .git 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 1 - initial setup

expecting success: 
	echo "gitdir $REAL" >.git &&
	if git rev-parse 2>.err
	then
		echo "git rev-parse accepted an invalid .git file"
		false
	fi &&
	if ! grep "Invalid gitfile format" .err
	then
		echo "git rev-parse returned wrong error"
		false
	fi

++ echo 'gitdir C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real'
++ git rev-parse
++ grep 'Invalid gitfile format' .err
fatal: Invalid gitfile format: C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.git
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 2 - bad setup: invalid .git file format

expecting success: 
	echo "gitdir: $REAL.not" >.git &&
	if git rev-parse 2>.err
	then
		echo "git rev-parse accepted an invalid .git file path"
		false
	fi &&
	if ! grep "Not a git repository" .err
	then
		echo "git rev-parse returned wrong error"
		false
	fi

++ echo 'gitdir: C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real.not'
++ git rev-parse
++ grep 'Not a git repository' .err
fatal: Not a git repository: C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real.not
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 3 - bad setup: invalid .git file path

expecting success: 
	echo "gitdir: $REAL" >.git &&
	test "$REAL" = "$(git rev-parse --git-dir)"

++ echo 'gitdir: C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real'
+++ git rev-parse --git-dir
++ test 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real' = 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 4 - final setup + check rev-parse --git-dir

expecting success: 
	echo "foo" >bar &&
	SHA=$(cat bar | git hash-object -w --stdin) &&
	objck $SHA

++ echo foo
+++ cat bar
+++ git hash-object -w --stdin
++ SHA=408935f8873a5ef17ef10cf2a316e51937e90f0b
++ objck 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ objpath 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ echo 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ sed -e 's|\(..\)|\1/|'
++ p=40/8935f8873a5ef17ef10cf2a316e51937e90f0b
++ test '!' -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/objects/40/8935f8873a5ef17ef10cf2a316e51937e90f0b'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 5 - check hash-object

expecting success: 
	git cat-file blob $SHA >actual &&
	test_cmp bar actual

++ git cat-file blob 408935f8873a5ef17ef10cf2a316e51937e90f0b
++ test_cmp bar actual
++ mingw_test_cmp bar actual
++ local test_cmp_a= test_cmp_b=
++ local stdin_for_diff=
++ test -s bar
++ test -s actual
++ mingw_read_file_strip_cr_ test_cmp_a
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='foo
'
++ eval 'test_cmp_a=$test_cmp_a$line'
+++ test_cmp_a='foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ mingw_read_file_strip_cr_ test_cmp_b
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='foo
'
++ eval 'test_cmp_b=$test_cmp_b$line'
+++ test_cmp_b='foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ test -n 'foo
'
++ test -n 'foo
'
++ test 'foo
' = 'foo
'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 6 - check cat-file

expecting success: 
	if test -f "$REAL/index"
	then
		echo "Hmm, $REAL/index exists?"
		false
	fi &&
	rm -f "$REAL/objects/$(objpath $SHA)" &&
	git update-index --add bar &&
	if ! test -f "$REAL/index"
	then
		echo "$REAL/index not found"
		false
	fi &&
	objck $SHA

++ test -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/index'
+++ objpath 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ echo 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ sed -e 's|\(..\)|\1/|'
++ rm -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/objects/40/8935f8873a5ef17ef10cf2a316e51937e90f0b'
++ git update-index --add bar
++ test -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/index'
++ objck 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ objpath 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ echo 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ sed -e 's|\(..\)|\1/|'
++ p=40/8935f8873a5ef17ef10cf2a316e51937e90f0b
++ test '!' -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/objects/40/8935f8873a5ef17ef10cf2a316e51937e90f0b'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 7 - check update-index

expecting success: 
	SHA=$(git write-tree) &&
	objck $SHA

+++ git write-tree
++ SHA=e4d61f313319b7230e7cfa1ff4689840cf00d849
++ objck e4d61f313319b7230e7cfa1ff4689840cf00d849
+++ objpath e4d61f313319b7230e7cfa1ff4689840cf00d849
+++ echo e4d61f313319b7230e7cfa1ff4689840cf00d849
+++ sed -e 's|\(..\)|\1/|'
++ p=e4/d61f313319b7230e7cfa1ff4689840cf00d849
++ test '!' -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/objects/e4/d61f313319b7230e7cfa1ff4689840cf00d849'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 8 - check write-tree

expecting success: 
	SHA=$(echo "commit bar" | git commit-tree $SHA) &&
	objck $SHA

+++ echo 'commit bar'
+++ git commit-tree e4d61f313319b7230e7cfa1ff4689840cf00d849
++ SHA=4c8b14b010e52d281007255073adc401731f65dc
++ objck 4c8b14b010e52d281007255073adc401731f65dc
+++ objpath 4c8b14b010e52d281007255073adc401731f65dc
+++ echo 4c8b14b010e52d281007255073adc401731f65dc
+++ sed -e 's|\(..\)|\1/|'
++ p=4c/8b14b010e52d281007255073adc401731f65dc
++ test '!' -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/objects/4c/8b14b010e52d281007255073adc401731f65dc'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 9 - check commit-tree

expecting success: 
	echo $SHA >"$REAL/HEAD" &&
	test "$SHA" = "$(git rev-list HEAD)"

++ echo 4c8b14b010e52d281007255073adc401731f65dc
+++ git rev-list HEAD
++ test 4c8b14b010e52d281007255073adc401731f65dc = 4c8b14b010e52d281007255073adc401731f65dc
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 10 - check rev-list

expecting success: 
	git init sgd &&
	(
		cd sgd &&
		git config alias.lsfi ls-files &&
		mv .git .realgit &&
		echo "gitdir: .realgit" >.git &&
		mkdir subdir &&
		cd subdir &&
		>foo &&
		git add foo &&
		git lsfi >actual &&
		echo foo >expected &&
		test_cmp expected actual
	)

++ git init sgd
Initialized empty Git repository in C:/agent/_work/3/s/t/trash directory.t0002-gitfile/sgd/.git/
++ cd sgd
++ git config alias.lsfi ls-files
++ mv .git .realgit
++ echo 'gitdir: .realgit'
++ mkdir subdir
++ cd subdir
++ git add foo
++ git lsfi
++ echo foo
++ test_cmp expected actual
++ mingw_test_cmp expected actual
++ local test_cmp_a= test_cmp_b=
++ local stdin_for_diff=
++ test -s expected
++ test -s actual
++ mingw_read_file_strip_cr_ test_cmp_a
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='foo
'
++ eval 'test_cmp_a=$test_cmp_a$line'
+++ test_cmp_a='foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ mingw_read_file_strip_cr_ test_cmp_b
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='foo
'
++ eval 'test_cmp_b=$test_cmp_b$line'
+++ test_cmp_b='foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ test -n 'foo
'
++ test -n 'foo
'
++ test 'foo
' = 'foo
'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 11 - setup_git_dir twice in subdir

expecting success: 
	test_create_repo enter_repo &&
	(
		cd enter_repo &&
		test_tick &&
		test_commit foo &&
		mv .git .realgit &&
		echo "gitdir: .realgit" >.git
	) &&
	git ls-remote enter_repo >actual &&
	cat >expected <<-\EOF &&
	946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
	946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
	946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
	EOF
	test_cmp expected actual

++ test_create_repo enter_repo
++ test 1 = 1
++ repo=enter_repo
++ mkdir -p enter_repo
++ cd enter_repo
++ /c/agent/_work/3/s/t/../git-init --template=/c/agent/_work/3/s/t/../templates/blt/
Initialized empty Git repository in C:/agent/_work/3/s/t/trash directory.t0002-gitfile/enter_repo/.git/
++ mv .git/hooks .git/hooks-disabled
++ cd enter_repo
++ test_tick
++ test -z ''
++ test_tick=1112911993
++ GIT_COMMITTER_DATE='1112911993 -0700'
++ GIT_AUTHOR_DATE='1112911993 -0700'
++ export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
++ test_commit foo
++ notick=
++ signoff=
++ indir=
++ test 1 '!=' 0
++ case "$1" in
++ break
++ indir=
++ file=foo.t
++ echo foo
++ git add foo.t
++ test -z ''
++ test_tick
++ test -z set
++ test_tick=1112912053
++ GIT_COMMITTER_DATE='1112912053 -0700'
++ GIT_AUTHOR_DATE='1112912053 -0700'
++ export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
++ git commit -m foo
[master (root-commit) 6b0e7e5] foo
 Author: A U Thor <author@example.com>
 1 file changed, 1 insertion(+)
 create mode 100644 foo.t
++ git tag foo
++ mv .git .realgit
++ echo 'gitdir: .realgit'
++ git ls-remote enter_repo
++ cat
++ test_cmp expected actual
++ mingw_test_cmp expected actual
++ local test_cmp_a= test_cmp_b=
++ local stdin_for_diff=
++ test -s expected
++ test -s actual
++ mingw_read_file_strip_cr_ test_cmp_a
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
'
++ eval 'test_cmp_a=$test_cmp_a$line'
+++ test_cmp_a='946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
'
++ eval 'test_cmp_a=$test_cmp_a$line'
+++ test_cmp_a='946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
'
++ eval 'test_cmp_a=$test_cmp_a$line'
+++ test_cmp_a='946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ mingw_read_file_strip_cr_ test_cmp_b
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
'
++ eval 'test_cmp_b=$test_cmp_b$line'
+++ test_cmp_b='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
'
++ eval 'test_cmp_b=$test_cmp_b$line'
+++ test_cmp_b='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/tags/foo
'
++ eval 'test_cmp_b=$test_cmp_b$line'
+++ test_cmp_b='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/tags/foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ test -n '946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
'
++ test -n '6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/tags/foo
'
++ test '946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
' = '6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/tags/foo
'
++ eval 'diff -u "$@" '
+++ diff -u expected actual
--- expected	2017-03-27 21:05:59.733384600 +0000
+++ actual	2017-03-27 21:05:59.704906300 +0000
@@ -1,3 +1,3 @@
-946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
-946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
-946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
+6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
+6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
+6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/tags/foo
+ test_eval_ret_=1
+ want_trace
+ test t = t
+ test t = t
+ set +x
error: last command exited with $?=1
not ok 12 - enter_repo non-strict mode
#	
#		test_create_repo enter_repo &&
#		(
#			cd enter_repo &&
#			test_tick &&
#			test_commit foo &&
#			mv .git .realgit &&
#			echo "gitdir: .realgit" >.git
#		) &&
#		git ls-remote enter_repo >actual &&
#		cat >expected <<-\EOF &&
#		946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
#		946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
#		946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
#		EOF
#		test_cmp expected actual
#	
make: *** [Makefile:49: t0002-gitfile.sh] Error 1
make: Leaving directory '/c/agent/_work/3/s/t'

git-for-windows-ci replied Mar 27, 2017

The administrative script of Git for Windows identified a problem with this commit while running t0002-gitfile.sh:

make: Entering directory '/c/agent/_work/3/s/t'
*** t0002-gitfile.sh ***
Initialized empty Git repository in C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.git/
expecting success: 
	REAL="$(pwd)/.real" &&
	mv .git "$REAL"

+++ pwd
+++ builtin pwd -W
++ REAL='C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real'
++ mv .git 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 1 - initial setup

expecting success: 
	echo "gitdir $REAL" >.git &&
	if git rev-parse 2>.err
	then
		echo "git rev-parse accepted an invalid .git file"
		false
	fi &&
	if ! grep "Invalid gitfile format" .err
	then
		echo "git rev-parse returned wrong error"
		false
	fi

++ echo 'gitdir C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real'
++ git rev-parse
++ grep 'Invalid gitfile format' .err
fatal: Invalid gitfile format: C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.git
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 2 - bad setup: invalid .git file format

expecting success: 
	echo "gitdir: $REAL.not" >.git &&
	if git rev-parse 2>.err
	then
		echo "git rev-parse accepted an invalid .git file path"
		false
	fi &&
	if ! grep "Not a git repository" .err
	then
		echo "git rev-parse returned wrong error"
		false
	fi

++ echo 'gitdir: C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real.not'
++ git rev-parse
++ grep 'Not a git repository' .err
fatal: Not a git repository: C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real.not
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 3 - bad setup: invalid .git file path

expecting success: 
	echo "gitdir: $REAL" >.git &&
	test "$REAL" = "$(git rev-parse --git-dir)"

++ echo 'gitdir: C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real'
+++ git rev-parse --git-dir
++ test 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real' = 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 4 - final setup + check rev-parse --git-dir

expecting success: 
	echo "foo" >bar &&
	SHA=$(cat bar | git hash-object -w --stdin) &&
	objck $SHA

++ echo foo
+++ cat bar
+++ git hash-object -w --stdin
++ SHA=408935f8873a5ef17ef10cf2a316e51937e90f0b
++ objck 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ objpath 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ echo 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ sed -e 's|\(..\)|\1/|'
++ p=40/8935f8873a5ef17ef10cf2a316e51937e90f0b
++ test '!' -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/objects/40/8935f8873a5ef17ef10cf2a316e51937e90f0b'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 5 - check hash-object

expecting success: 
	git cat-file blob $SHA >actual &&
	test_cmp bar actual

++ git cat-file blob 408935f8873a5ef17ef10cf2a316e51937e90f0b
++ test_cmp bar actual
++ mingw_test_cmp bar actual
++ local test_cmp_a= test_cmp_b=
++ local stdin_for_diff=
++ test -s bar
++ test -s actual
++ mingw_read_file_strip_cr_ test_cmp_a
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='foo
'
++ eval 'test_cmp_a=$test_cmp_a$line'
+++ test_cmp_a='foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ mingw_read_file_strip_cr_ test_cmp_b
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='foo
'
++ eval 'test_cmp_b=$test_cmp_b$line'
+++ test_cmp_b='foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ test -n 'foo
'
++ test -n 'foo
'
++ test 'foo
' = 'foo
'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 6 - check cat-file

expecting success: 
	if test -f "$REAL/index"
	then
		echo "Hmm, $REAL/index exists?"
		false
	fi &&
	rm -f "$REAL/objects/$(objpath $SHA)" &&
	git update-index --add bar &&
	if ! test -f "$REAL/index"
	then
		echo "$REAL/index not found"
		false
	fi &&
	objck $SHA

++ test -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/index'
+++ objpath 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ echo 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ sed -e 's|\(..\)|\1/|'
++ rm -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/objects/40/8935f8873a5ef17ef10cf2a316e51937e90f0b'
++ git update-index --add bar
++ test -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/index'
++ objck 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ objpath 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ echo 408935f8873a5ef17ef10cf2a316e51937e90f0b
+++ sed -e 's|\(..\)|\1/|'
++ p=40/8935f8873a5ef17ef10cf2a316e51937e90f0b
++ test '!' -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/objects/40/8935f8873a5ef17ef10cf2a316e51937e90f0b'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 7 - check update-index

expecting success: 
	SHA=$(git write-tree) &&
	objck $SHA

+++ git write-tree
++ SHA=e4d61f313319b7230e7cfa1ff4689840cf00d849
++ objck e4d61f313319b7230e7cfa1ff4689840cf00d849
+++ objpath e4d61f313319b7230e7cfa1ff4689840cf00d849
+++ echo e4d61f313319b7230e7cfa1ff4689840cf00d849
+++ sed -e 's|\(..\)|\1/|'
++ p=e4/d61f313319b7230e7cfa1ff4689840cf00d849
++ test '!' -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/objects/e4/d61f313319b7230e7cfa1ff4689840cf00d849'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 8 - check write-tree

expecting success: 
	SHA=$(echo "commit bar" | git commit-tree $SHA) &&
	objck $SHA

+++ echo 'commit bar'
+++ git commit-tree e4d61f313319b7230e7cfa1ff4689840cf00d849
++ SHA=4c8b14b010e52d281007255073adc401731f65dc
++ objck 4c8b14b010e52d281007255073adc401731f65dc
+++ objpath 4c8b14b010e52d281007255073adc401731f65dc
+++ echo 4c8b14b010e52d281007255073adc401731f65dc
+++ sed -e 's|\(..\)|\1/|'
++ p=4c/8b14b010e52d281007255073adc401731f65dc
++ test '!' -f 'C:/agent/_work/3/s/t/trash directory.t0002-gitfile/.real/objects/4c/8b14b010e52d281007255073adc401731f65dc'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 9 - check commit-tree

expecting success: 
	echo $SHA >"$REAL/HEAD" &&
	test "$SHA" = "$(git rev-list HEAD)"

++ echo 4c8b14b010e52d281007255073adc401731f65dc
+++ git rev-list HEAD
++ test 4c8b14b010e52d281007255073adc401731f65dc = 4c8b14b010e52d281007255073adc401731f65dc
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 10 - check rev-list

expecting success: 
	git init sgd &&
	(
		cd sgd &&
		git config alias.lsfi ls-files &&
		mv .git .realgit &&
		echo "gitdir: .realgit" >.git &&
		mkdir subdir &&
		cd subdir &&
		>foo &&
		git add foo &&
		git lsfi >actual &&
		echo foo >expected &&
		test_cmp expected actual
	)

++ git init sgd
Initialized empty Git repository in C:/agent/_work/3/s/t/trash directory.t0002-gitfile/sgd/.git/
++ cd sgd
++ git config alias.lsfi ls-files
++ mv .git .realgit
++ echo 'gitdir: .realgit'
++ mkdir subdir
++ cd subdir
++ git add foo
++ git lsfi
++ echo foo
++ test_cmp expected actual
++ mingw_test_cmp expected actual
++ local test_cmp_a= test_cmp_b=
++ local stdin_for_diff=
++ test -s expected
++ test -s actual
++ mingw_read_file_strip_cr_ test_cmp_a
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='foo
'
++ eval 'test_cmp_a=$test_cmp_a$line'
+++ test_cmp_a='foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ mingw_read_file_strip_cr_ test_cmp_b
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='foo
'
++ eval 'test_cmp_b=$test_cmp_b$line'
+++ test_cmp_b='foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ test -n 'foo
'
++ test -n 'foo
'
++ test 'foo
' = 'foo
'
+ test_eval_ret_=0
+ want_trace
+ test t = t
+ test t = t
+ set +x
ok 11 - setup_git_dir twice in subdir

expecting success: 
	test_create_repo enter_repo &&
	(
		cd enter_repo &&
		test_tick &&
		test_commit foo &&
		mv .git .realgit &&
		echo "gitdir: .realgit" >.git
	) &&
	git ls-remote enter_repo >actual &&
	cat >expected <<-\EOF &&
	946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
	946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
	946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
	EOF
	test_cmp expected actual

++ test_create_repo enter_repo
++ test 1 = 1
++ repo=enter_repo
++ mkdir -p enter_repo
++ cd enter_repo
++ /c/agent/_work/3/s/t/../git-init --template=/c/agent/_work/3/s/t/../templates/blt/
Initialized empty Git repository in C:/agent/_work/3/s/t/trash directory.t0002-gitfile/enter_repo/.git/
++ mv .git/hooks .git/hooks-disabled
++ cd enter_repo
++ test_tick
++ test -z ''
++ test_tick=1112911993
++ GIT_COMMITTER_DATE='1112911993 -0700'
++ GIT_AUTHOR_DATE='1112911993 -0700'
++ export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
++ test_commit foo
++ notick=
++ signoff=
++ indir=
++ test 1 '!=' 0
++ case "$1" in
++ break
++ indir=
++ file=foo.t
++ echo foo
++ git add foo.t
++ test -z ''
++ test_tick
++ test -z set
++ test_tick=1112912053
++ GIT_COMMITTER_DATE='1112912053 -0700'
++ GIT_AUTHOR_DATE='1112912053 -0700'
++ export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
++ git commit -m foo
[master (root-commit) 6b0e7e5] foo
 Author: A U Thor <author@example.com>
 1 file changed, 1 insertion(+)
 create mode 100644 foo.t
++ git tag foo
++ mv .git .realgit
++ echo 'gitdir: .realgit'
++ git ls-remote enter_repo
++ cat
++ test_cmp expected actual
++ mingw_test_cmp expected actual
++ local test_cmp_a= test_cmp_b=
++ local stdin_for_diff=
++ test -s expected
++ test -s actual
++ mingw_read_file_strip_cr_ test_cmp_a
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
'
++ eval 'test_cmp_a=$test_cmp_a$line'
+++ test_cmp_a='946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
'
++ eval 'test_cmp_a=$test_cmp_a$line'
+++ test_cmp_a='946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
'
++ eval 'test_cmp_a=$test_cmp_a$line'
+++ test_cmp_a='946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ mingw_read_file_strip_cr_ test_cmp_b
++ local line
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
'
++ eval 'test_cmp_b=$test_cmp_b$line'
+++ test_cmp_b='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
'
++ eval 'test_cmp_b=$test_cmp_b$line'
+++ test_cmp_b='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ line='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/tags/foo
'
++ eval 'test_cmp_b=$test_cmp_b$line'
+++ test_cmp_b='6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/tags/foo
'
++ :
++ IFS=$'\r'
++ read -r -d '
' line
++ test -z ''
++ break
++ test -n '946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
'
++ test -n '6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/tags/foo
'
++ test '946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
' = '6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/tags/foo
'
++ eval 'diff -u "$@" '
+++ diff -u expected actual
--- expected	2017-03-27 21:05:59.733384600 +0000
+++ actual	2017-03-27 21:05:59.704906300 +0000
@@ -1,3 +1,3 @@
-946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
-946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
-946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
+6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	HEAD
+6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/heads/master
+6b0e7e571dc634a17fca9ad18ff9ddb3bf3ac0d1	refs/tags/foo
+ test_eval_ret_=1
+ want_trace
+ test t = t
+ test t = t
+ set +x
error: last command exited with $?=1
not ok 12 - enter_repo non-strict mode
#	
#		test_create_repo enter_repo &&
#		(
#			cd enter_repo &&
#			test_tick &&
#			test_commit foo &&
#			mv .git .realgit &&
#			echo "gitdir: .realgit" >.git
#		) &&
#		git ls-remote enter_repo >actual &&
#		cat >expected <<-\EOF &&
#		946e985ab20de757ca5b872b16d64e92ff3803a9	HEAD
#		946e985ab20de757ca5b872b16d64e92ff3803a9	refs/heads/master
#		946e985ab20de757ca5b872b16d64e92ff3803a9	refs/tags/foo
#		EOF
#		test_cmp expected actual
#	
make: *** [Makefile:49: t0002-gitfile.sh] Error 1
make: Leaving directory '/c/agent/_work/3/s/t'
@git-for-windows-ci

This comment has been minimized.

Show comment
Hide comment
@git-for-windows-ci

git-for-windows-ci Mar 27, 2017

The administrative script of Git for Windows identified a problem with this commit while running t0013-sha1dc.sh:

make: Entering directory '/c/agent/_work/3/s/t'
*** t0013-sha1dc.sh ***
Initialized empty Git repository in C:/agent/_work/3/s/t/trash directory.t0013-sha1dc/.git/
expecting success: 
	test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
	test_i18ngrep collision err &&
	grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err

++ test_must_fail test-sha1
++ case "$1" in
++ _test_ok=
++ test-sha1
080143313fa76658de1ac715a5a9386dd742f47b
++ exit_code=0
++ test 0 -eq 0
++ list_contains '' success
++ case ",$1," in
++ return 1
++ echo 'test_must_fail: command succeeded: test-sha1'
++ return 1
+ test_eval_ret_=1
+ want_trace
+ test t = t
+ test t = t
+ set +x
error: last command exited with $?=1
not ok 1 - test-sha1 detects shattered pdf
#	
#		test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
#		test_i18ngrep collision err &&
#		grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
#	
make: *** [Makefile:49: t0013-sha1dc.sh] Error 1
make: Leaving directory '/c/agent/_work/3/s/t'

git-for-windows-ci replied Mar 27, 2017

The administrative script of Git for Windows identified a problem with this commit while running t0013-sha1dc.sh:

make: Entering directory '/c/agent/_work/3/s/t'
*** t0013-sha1dc.sh ***
Initialized empty Git repository in C:/agent/_work/3/s/t/trash directory.t0013-sha1dc/.git/
expecting success: 
	test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
	test_i18ngrep collision err &&
	grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err

++ test_must_fail test-sha1
++ case "$1" in
++ _test_ok=
++ test-sha1
080143313fa76658de1ac715a5a9386dd742f47b
++ exit_code=0
++ test 0 -eq 0
++ list_contains '' success
++ case ",$1," in
++ return 1
++ echo 'test_must_fail: command succeeded: test-sha1'
++ return 1
+ test_eval_ret_=1
+ want_trace
+ test t = t
+ test t = t
+ set +x
error: last command exited with $?=1
not ok 1 - test-sha1 detects shattered pdf
#	
#		test_must_fail test-sha1 <"$TEST_DATA/shattered-1.pdf" 2>err &&
#		test_i18ngrep collision err &&
#		grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err
#	
make: *** [Makefile:49: t0013-sha1dc.sh] Error 1
make: Leaving directory '/c/agent/_work/3/s/t'
Please sign in to comment.