git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: t4216-log-bloom.sh broken ?

From
Junio C Hamano <gitster@pobox.com>
Date
May 2, 2024, 20:15 UTC
Message-ID
<xmqqsez0c6ma.fsf@gitster.g>
In-Reply-To
<xmqq7cgcdm4f.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
> I am curious what other differences Torsten will find out between
> good macs and bad ones.  Perhaps we can narrow down the bad apples?

So, "no, your 'mv' is broken" seems to be the answer to the question on the Subject line, and it is rather well-known, it seems.

----- >8 --------- >8 --------- >8 --------- >8 -----
Subject: [PATCH] t/lib-chunk: work around broken "mv" on some vintage of macOS

When the destination is read-only, "mv" on some version of macOS asks whether to replace the destination even though in the test its stdin is not a terminal (and thus doesn't conform to POSIX[1]).

The helper to corrupt a chunk-file is designed to work on the files like commit-graph and multi-pack-index files that are generally read-only, so use "mv -f" to work around this issue.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/lib-chunk.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/lib-chunk.sh b/t/lib-chunk.sh
index a7cd9c3c6d..9f01df190b 100644
--- a/t/lib-chunk.sh
+++ b/t/lib-chunk.sh
@@ -13,5 +13,6 @@ corrupt_chunk_file () {
 	fn=$1; shift
 	perl "$TEST_DIRECTORY"/lib-chunk/corrupt-chunk-file.pl \
 		"$@" <"$fn" >"$fn.tmp" &&
-	mv "$fn.tmp" "$fn"
+	# some vintages of macOS 'mv' fails to overwrite a read-only file.
+	mv -f "$fn.tmp" "$fn"
 }
-- 
2.45.0-31-gd4cc1ec35f
Previous: Junio C HamanoNext: Torsten Bögershausen
Message 9 of 12 in “[ANNOUNCE] Git v2.45.0”
  1. Junio C HamanoApr 29, 2024
  2. rsbecker@nexbridge.comMay 1, 2024
  3. t4216-log-bloom.sh broken ?Torsten Bögershausen, May 2, 2024
  4. Junio C HamanoMay 2, 2024
  5. Torsten BögershausenMay 2, 2024
  6. SZEDER GáborMay 2, 2024
  7. Junio C HamanoMay 2, 2024
  8. Junio C HamanoMay 2, 2024
  9. Junio C HamanoMay 2, 2024
  10. Torsten BögershausenMay 2, 2024
  11. Junio C HamanoMay 2, 2024
  12. Junio C HamanoMay 2, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.