From 0c5b438914551c1a1ca173e6cc160969f5596798 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Wed, 26 Nov 2025 16:00:09 +0100 Subject: [PATCH 1/2] Fix incorrect results in git-last-modified(1) It was reported [1] the tests in t8020 fail on s390x. After some research, it seems it was related to s390x being big-endian. Well, actually, not really. Using big-endian simply uncovered the problem in test. [1]: https://lore.kernel.org/git/4dc4c8cd-c0cc-4784-8fcf-defa3a051087@mit.edu/ Cc: Jeff King Cc: Anders Kaseorg Cc: Karthik Nayak --- b4-submit-tracking --- # This section is used internally by b4 prep for tracking purposes. { "series": { "revision": 1, "change-id": "20251126-toon-big-endian-ci-fe62bb361974", "prefixes": [] } } -- GitLab From 4e145b56296e59fa9d98898d8797bbd42de1c76d Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Fri, 28 Nov 2025 16:08:41 +0100 Subject: [PATCH 2/2] last-modified: fix bug caused by inproper initialized memory git-last-modified(1) uses a scratch bitmap to keep track of paths that have been changed between commits. To avoid reallocating a bitmap on each call of process_parent(), the scratch bitmap is kept and reused. Although, it seems an incorrect length is passed to memset(3). `struct bitmap` uses `eword_t` to for internal storage. This type is typedef'd to uint64_t. To fully zero the memory used by the bitmap, multiply the length (saved in `struct bitmap::word_alloc`) by the size of `eword_t`. Reported-by: Anders Kaseorg Helped-by: Jeff King Signed-off-by: Toon Claes --- builtin/last-modified.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/last-modified.c b/builtin/last-modified.c index b0ecbdc540..cc5fd2e795 100644 --- a/builtin/last-modified.c +++ b/builtin/last-modified.c @@ -327,7 +327,7 @@ static void process_parent(struct last_modified *lm, if (!(parent->object.flags & PARENT1)) active_paths_free(lm, parent); - memset(lm->scratch->words, 0x0, lm->scratch->word_alloc); + memset(lm->scratch->words, 0x0, lm->scratch->word_alloc * sizeof(eword_t)); diff_queue_clear(&diff_queued_diff); } -- GitLab