From fafbf3921eae6c53539f4c5de24e801365ec4af3 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 15 May 2018 16:47:21 -0400 Subject: list2typedef: Remove trailing newline from preimage Oops---we do not want a newline as part of the preimage, which is what `<<<' does. * build-aux/list2typedef (output-item)[value]: Remove newline from preimage. * build-aux/test/test-list2typedef (test-typedef-gen): Update hashes. (test-collision-value-check): Add new collisions. --- build-aux/list2typedef | 2 +- build-aux/test/test-list2typedef | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'build-aux') diff --git a/build-aux/list2typedef b/build-aux/list2typedef index fdb5c59..3a18cf3 100755 --- a/build-aux/list2typedef +++ b/build-aux/list2typedef @@ -66,7 +66,7 @@ output-item() local name; read -r name local -r const=$( constify "$typedef" <<< "$name" ) - local -r value=$( hash-name "$bytes" <<< "$name" ) + local -r value=$( echo -n "$name" | hash-name "$bytes" ) assert-collision "$const" "$value" diff --git a/build-aux/test/test-list2typedef b/build-aux/test/test-list2typedef index e417c02..62a5bd8 100755 --- a/build-aux/test/test-list2typedef +++ b/build-aux/test/test-list2typedef @@ -41,9 +41,9 @@ Second'\''s @ @Line title="FooType Type"> - - - + + + ' @@ -79,11 +79,11 @@ test-collision-value-check() # we can easily force a collision by reducing the number of bytes to 1 and # calculating hashes from /usr/share/dict/words; this is one example - local err=$( ../list2typedef Foo 1 2>&1 >/dev/null <<< 'abacist -abatis + local err=$( ../list2typedef Foo 1 2>&1 >/dev/null <<< 'abase +abate ' && echo 'EXPECTED FAILURE' ) - [[ "$err" =~ ABATIS && "$err" =~ '44' ]] || { + [[ "$err" =~ ABATE && "$err" =~ '157' ]] || { echo 'expecting useful error message for value collion' >&2 return 1 } -- cgit v1.2.1