From 61b7079c2f92b5909010f3a5b94354e88045db32 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Sat, 19 Oct 2019 19:57:53 -0400 Subject: [PATCH] fix t0500-progress-display on big-endian arches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to SZEDER Gábor for a quick patch. --- ...x-test-failures-on-big-endian-system.patch | 55 +++++++++++++++++++ git.spec | 4 ++ 2 files changed, 59 insertions(+) create mode 100644 0001-test-progress-fix-test-failures-on-big-endian-system.patch diff --git a/0001-test-progress-fix-test-failures-on-big-endian-system.patch b/0001-test-progress-fix-test-failures-on-big-endian-system.patch new file mode 100644 index 0000000..ba00b70 --- /dev/null +++ b/0001-test-progress-fix-test-failures-on-big-endian-system.patch @@ -0,0 +1,55 @@ +From 1ac77295ff34b80bd8c17887f9a84b8557a9c0cd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= +Date: Sun, 20 Oct 2019 01:37:06 +0200 +Subject: [PATCH] test-progress: fix test failures on big-endian systems +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In 't0500-progress-display.sh' all tests running 'test-tool progress +--total=' fail on big-endian systems, e.g. like this: + + |+ test-tool progress --total=3 Working hard + |[...] + |+ test_i18ncmp expect out + |--- expect 2019-10-18 23:07:54.765523916 +0000 + |+++ out 2019-10-18 23:07:54.773523916 +0000 + |@@ -1,4 +1,2 @@ + |-Working hard: 33% (1/3) + |-Working hard: 66% (2/3) + |-Working hard: 100% (3/3) + |-Working hard: 100% (3/3), done. + |+Working hard: 0% (1/12884901888) + |+Working hard: 0% (3/12884901888), done. + +The reason for that bogus value is that '--total's parameter is parsed +via parse-options's OPT_INTEGER into a uint64_t variable [1], so the +two bits of 3 end up in the "wrong" bytes on big-endian systems +(12884901888 = 0x300000000). + +Change the type of that variable from uint64_t to int, to match what +parse-options expects; in the tests of the progress output we won't +use values that don't fit into an int anyway. + +[1] start_progress() expects the total number as an uint64_t, that's + why I chose the same type when declaring the variable holding the + value given on the command line. + +Signed-off-by: SZEDER Gábor +--- + t/helper/test-progress.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/t/helper/test-progress.c b/t/helper/test-progress.c +index 4e9f7fafdf..42b96cb103 100644 +--- a/t/helper/test-progress.c ++++ b/t/helper/test-progress.c +@@ -29,7 +29,7 @@ void progress_test_force_update(void); + + int cmd__progress(int argc, const char **argv) + { +- uint64_t total = 0; ++ int total = 0; + const char *title; + struct strbuf line = STRBUF_INIT; + struct progress *progress; diff --git a/git.spec b/git.spec index f65d331..29d50c4 100644 --- a/git.spec +++ b/git.spec @@ -120,6 +120,9 @@ Source99: print-failed-test-output # https://bugzilla.redhat.com/490602 Patch0: git-cvsimport-Ignore-cvsps-2.2b1-Branches-output.patch +# https://public-inbox.org/git/20191019233706.GM29845@szeder.dev/ +Patch1: 0001-test-progress-fix-test-failures-on-big-endian-system.patch + %if %{with docs} # pod2man is needed to build Git.3pm BuildRequires: %{_bindir}/pod2man @@ -1015,6 +1018,7 @@ rmdir --ignore-fail-on-non-empty "$testdir" %changelog * Sat Oct 19 2019 Todd Zullinger - 2.24.0-0.0.rc0 - update to 2.24.0-rc0 +- fix t0500-progress-display on big-endian arches * Fri Aug 16 2019 Todd Zullinger - 2.23.0-1 - Update to 2.23.0