From: SZEDER Gábor Date: Sat, 24 Oct 2026 19:43:09 GMT Subject: Re: [PATCH v1 1/1] t1450: use mv -f when overwriting a read only file Message-ID: In-Reply-To: <20261024183056.6342-1-tboegi@web.de> On Sat, Oct 24, 2026 at 08:30:56PM +0200, tboegi@web.de wrote: > From: Torsten Bögershausen > > test case 38 in t/t1450-fsck.sh replaces a loose blob, "$tmp" below, > with a trucated version "obj.tmp" using > > mv obj.tmp "$obj" > > This fails on some sytems, like older MacOS. > `man mv` > includes this information: > The following options are available: > -f Do not prompt for confirmation before overwriting the destination > path. (The -f option overrides any previous -i or -n options.) > and further down: > If the destination path does not have a mode which permits writing, mv > prompts the user for confirmation as specified for the -i option. > > Running the test case in debug and verbose mode `./t1450-fsck.sh -d -v` > shows this lines (which I have shortened to fit into 72 characters) > > override r--r--r-- user/staff for .git/objects/fc/a75a5be3823dc0560da5? > (y/n [n]) not overwritten > fca75a5be3823dc0560da57ade678f212aeb33f6 > > POSIX mentions that the observed > "prompt to standard error and read a line from standard input" > should not be done when "standard input is a terminal". > So we may blame the "standard input is a terminal" logic to fail. > > Side note: Answering with 'y' to the question of `mv` like this > (echo y | mv obj.tmp "$obj") > makes the test case pass. > > To make things not too complicated use the most portable form > mv -f obj.tmp "$obj" > > Signed-off-by: Torsten Bögershausen > --- > > So it was not the shell being old - but /bin/mv > > t/t1450-fsck.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh > index 16cc5d5dcb..335dcbf0af 100755 > --- a/t/t1450-fsck.sh > +++ b/t/t1450-fsck.sh > @@ -548,7 +548,7 @@ test_expect_success 'rev-list --verify-objects with truncated loose blob' ' > # Truncate the loose blob such that its header can still be > # parsed, but reading the object data fails mid-stream. > test_copy_bytes 64 <"$obj" >obj.tmp && > - mv obj.tmp "$obj" && > + mv -v obj.tmp "$obj" && You want force, not verbosity. Btw, don't you have a bit of a dejà vu? :) https://lore.kernel.org/git/20240502185903.GA11895@tb-raspi4/T/#u > > test_must_fail git rev-list --verify-objects "$blob" 2>err && > test_grep "hash mismatch" err > -- > 2.50.0.rc0.46.g7014b55638 >