From 27d047f669f36fdf376a5b2bba6cc35048534707 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Thu, 21 Nov 2024 05:06:41 -0500 Subject: [PATCH 1/4] Try ignoring archives in 32-bit CI nextest --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74af5d263ff..aa5ec02f2d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -232,6 +232,8 @@ jobs: - name: Make `system` scope nonempty for "GitInstallation" tests run: git config --system gitoxide.imaginary.arbitraryVariable arbitraryValue - name: Test (nextest) + env: + GIX_TEST_IGNORE_ARCHIVES: '1' run: cargo nextest run --workspace --no-fail-fast test-32bit-cross: From 595929bdf8ea50b243d82b69042e99c9679dc935 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 23 Nov 2024 00:58:19 -0500 Subject: [PATCH 2/4] Temporarily `set -x` to reveal `git tag` failure This temporarily instruments a fixture script to reveal how the `access::generation_numbers_overflow_is_handled_in_chained_graph` test fails when `GIX_TEST_IGNORE_ARCHIVES=1` is set: the fixture script `generation_number_overflow.sh` runs, and it sets the timestamp `@4147483646` on a commit, which `git` permits. But then `git tag` rejects this timestamp as being out of range. On stderr: + commit future-1 '@4147483646 +0000' + local message=future-1 + local 'date=@4147483646 +0000' + local file=future-1.t + echo future-1 + git add -- future-1.t + '[' -n '@4147483646 +0000' ']' + export 'GIT_COMMITTER_DATE=@4147483646 +0000' + GIT_COMMITTER_DATE='@4147483646 +0000' + git commit -m future-1 + git tag future-1 fatal: Timestamp too large for this system: 4147483646 The nature of the problem is *partially* illuminated by the following experiment on a 32-bit Debian 12 system: $ git init repo Initialized empty Git repository in /home/ek/src/repo/.git/ $ cd repo $ touch a $ git add a $ GIT_COMMITTER_DATE='@4147483646 +0000' git commit -m 'Initial commit' [main (root-commit) 99b1de4] Initial commit 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 a $ git log --pretty=fuller commit 99b1de4e0610ff715e784bd4089dc315e8071332 (HEAD -> main) Author: Eliah Kagan AuthorDate: Sat Nov 23 01:05:12 2024 -0500 Commit: Eliah Kagan CommitDate: Thu Jan 1 00:00:00 1970 +0000 Initial commit $ git tag t fatal: Timestamp too large for this system: 4147483646 $ git tag -a t fatal: Timestamp too large for this system: 4147483646 The timestamp is accepted when committing, and written as actor metadata for the committer. But is is not (or at least not always) interpreted as intended: as `git log` shows it, it has wrapped around to 1970. Even though the commit was created successfully, attempting to make a tag that points to it fails. This happens both for a lightweight tag (as in the fixture script) and an annotated tag, so making it a tag object does not seem to be a workaround. --- gix-commitgraph/tests/fixtures/generation_number_overflow.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/gix-commitgraph/tests/fixtures/generation_number_overflow.sh b/gix-commitgraph/tests/fixtures/generation_number_overflow.sh index 1bbe2dfdf31..a40182b1cba 100755 --- a/gix-commitgraph/tests/fixtures/generation_number_overflow.sh +++ b/gix-commitgraph/tests/fixtures/generation_number_overflow.sh @@ -36,6 +36,7 @@ FUTURE_DATE="@4147483646 +0000" git init git config commitGraph.generationVersion 2 +set -x commit future-1 "$FUTURE_DATE" commit old-1 "$UNIX_EPOCH_ZERO" git commit-graph write --reachable From 2a242503d22cfa6311ef1ad01a84904a025719f2 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 23 Nov 2024 02:54:32 -0500 Subject: [PATCH 3/4] Manually create tag if 32-bit `git` rejects it This is a workaround for the problem where `git tag` rejects the timestamp `4147483646` from `generation_number_overflow.sh` as out of range, even though it has already been accepted to create a commit and `git tag` is obtaining it from the commit metadata. The test already passed if run without `GIX_TEST_IGNORE_ARCHIVES`, even though the commit and tag metadata in the committed archive repo has this timestamp interpreted as from 1970 rather than in the far future. The change here just allows the fixture script to create the repository on a 32-bit system where `git` would refuse to make the tag, by manually creating a loose tag. (Creating a packed tag would also work, but would not improve the ambiguity.) --- .../fixtures/generation_number_overflow.sh | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/gix-commitgraph/tests/fixtures/generation_number_overflow.sh b/gix-commitgraph/tests/fixtures/generation_number_overflow.sh index a40182b1cba..6da76f786d3 100755 --- a/gix-commitgraph/tests/fixtures/generation_number_overflow.sh +++ b/gix-commitgraph/tests/fixtures/generation_number_overflow.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eu -o pipefail -function tick () { +function tick() { if test -z "${tick+set}" then tick=1112911993 @@ -13,9 +13,25 @@ function tick () { export GIT_COMMITTER_DATE GIT_AUTHOR_DATE } -tick -function commit() { - local message=${1:?first argument is the commit message} +function force_tag() { + local name head_oid common_dir + name=${1:?argument the tag name} + + # This should only be needed with 32-bit `git`, so fail otherwise. + word_size="$( + git --version --build-options | + awk '$1 == "sizeof-size_t:" { print $2 }' + )" + ((word_size == 4)) + + # Manually create the tag. + head_oid="$(git rev-parse HEAD)" + common_dir="$(git rev-parse --git-common-dir)" + (set -o noclobber; echo "$head_oid" > "$common_dir/refs/tags/$name") +} + +function tagged_commit() { + local message=${1:?first argument is the commit message and tag name} local date=${2:-} local file="$message.t" echo "$1" > "$file" @@ -26,9 +42,11 @@ function commit() { tick fi git commit -m "$message" - git tag "$message" + git tag -- "$message" || force_tag "$message" } +tick + # adapted from git/t/t5318 'lower layers have overflow chunk' UNIX_EPOCH_ZERO="@0 +0000" FUTURE_DATE="@4147483646 +0000" @@ -36,13 +54,12 @@ FUTURE_DATE="@4147483646 +0000" git init git config commitGraph.generationVersion 2 -set -x -commit future-1 "$FUTURE_DATE" -commit old-1 "$UNIX_EPOCH_ZERO" +tagged_commit future-1 "$FUTURE_DATE" +tagged_commit old-1 "$UNIX_EPOCH_ZERO" git commit-graph write --reachable -commit future-2 "$FUTURE_DATE" -commit old-2 "$UNIX_EPOCH_ZERO" +tagged_commit future-2 "$FUTURE_DATE" +tagged_commit old-2 "$UNIX_EPOCH_ZERO" git commit-graph write --reachable --split=no-merge -commit extra +tagged_commit extra # this makes sure it's actually in chain format. git commit-graph write --reachable --split=no-merge From 807c51efd6ce51bcc60e1b41c262bfbf29884918 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sat, 23 Nov 2024 08:27:11 +0000 Subject: [PATCH 4/4] Update generation_number_overflow archive --- .../generation_number_overflow.tar | Bin 98304 -> 98304 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/gix-commitgraph/tests/fixtures/generated-archives/generation_number_overflow.tar b/gix-commitgraph/tests/fixtures/generated-archives/generation_number_overflow.tar index 396b512951cce0d2269307e0591667ca4dea577b..13dfbb09248273154da4882455bc088d038db02e 100644 GIT binary patch delta 472 zcmXxcO(+Cm9LMqf&pyx0FmF4o&E8g79P4}gkjWfJmUstvLmf*VB6QhIqy>0&j@ma@(^&RXS(G8japZt77W z%5YF7b;(D;QX1L&HRfBa9BYHs&zhHsvi*inCO|`6td({*z&T_?ZT1XsT6;8NB#cBX lYP2lRPOnfs4X;28Bfueh2}FAykUa*7hSG2ke`hw-{R?UJlSu#o delta 469 zcmXw#J4*vW6h?D*XEsZACYwYJ5iC;37UCm>XrfipXrqV^f=yzhq9`_M5NskAHa1}+ zSlKLYTFHQmB5L#x2wGTJL>p~1_`o9KW5>i|?)io@-z_Gam9klBA0q>MB!-EAnDYb+ zftl27!j~FK{?p-*!9lK5dh1!}PbyEz9WFU*^6F4uIE(#BwfgeTC1<@ktRL4Uxm(k? z$M%OoT-hrZt{S237p+MU~ zFz7ScqaYdd(LVQ5f%b!BQ3B1#(purcY0&^Q6HD{hxj+Yj6sQFDvrgWr+9A$weSAcC za{}IQ(N6?MGCxg*67m~Ln`9{cZbJ#$9QQCKFS?j}3uLD5emEJPa`~9r@+C47_z{_+ zRYe2K_U|IZ@VU#))N4C6+`fto-?$J{FF)*b{0ZhPAafPaK^jyfc6WwZV)+zu!7g(O p1U1~-6N|*6p=h*YWpQrR@@Aj{*7p(!$Xo!~3TB`TwV4aXe*u8Sk=+0Q