Subject: Re: t4216-log-bloom.sh broken ?

From: SZEDER Gábor <[email-masked]>
Date: Thu, 2 May 2024 21:26:22 +0200

On Thu, May 02, 2024 at 08:59:03PM +0200, Torsten Bögershausen wrote:
> On Thu, May 02, 2024 at 09:06:41AM -0700, Junio C Hamano wrote:
> > Torsten Bögershausen <[email-masked]> writes:
> >
> > > There are 4 test cases in t4216-log-bloom.sh, that do not pass on one
> > > Mac here (they pass on another machine)
> >
> > Another machine being another mac?
> 
> Yes, different mac, different MacOs, different $PATH probably.
> 
> >
> > > expecting success of 4216.141 'Bloom reader notices too-small data chunk':
> > > 	check_corrupt_graph BDAT clear 00000000 &&
> > > 	echo "warning: ignoring too-small changed-path chunk" \
> > > 		"(4 < 12) in commit-graph file" >expect.err &&
> > > 	test_cmp expect.err err
> > >
> > > ++ check_corrupt_graph BDAT clear 00000000
> > > ++ corrupt_graph BDAT clear 00000000
> > > ++ graph=.git/objects/info/commit-graph
> > > ++ test_when_finished 'rm -rf .git/objects/info/commit-graph'
> > > ++ test 0 = 0
> > > ++ test_cleanup='{ rm -rf .git/objects/info/commit-graph
> > > 		} && (exit "$eval_ret"); eval_ret=$?; :'
> > > ++ git commit-graph write --reachable --changed-paths
> > > ++ corrupt_chunk_file .git/objects/info/commit-graph BDAT clear 00000000
> > > ++ fn=.git/objects/info/commit-graph
> > > ++ shift
> > > ++ perl /Users/tb/NoBackup/projects/git/git.pu/t/lib-chunk/corrupt-chunk-file.pl BDAT clear 00000000
> > > ++ command /usr/bin/perl /Users/tb/NoBackup/projects/git/git.pu/t/lib-chunk/corrupt-chunk-file.pl BDAT clear 00000000
> > > ++ /usr/bin/perl /Users/tb/NoBackup/projects/git/git.pu/t/lib-chunk/corrupt-chunk-file.pl BDAT clear 00000000
> > > ++ mv .git/objects/info/commit-graph.tmp .git/objects/info/commit-graph
> > > override r--r--r--  tb/staff for .git/objects/info/commit-graph? (y/n [n]) not overwritten
> >
> > Is this failure preventing the later steps of the test work as
> > expected, I wonder.  Is there something curious with the permission
> > bits of /Users/tb/NoBackup/projects/git/git.pu/ directory or its t/
> > subdirectory?  Is there something curious with the "umask" of the
> > user running the test?  Are they different from what you see on your
> > other mac that does not exhibit the problems?
> >
> > Thanks.
> >
> >
> 
> mv is /bin/mv, that seems to be good:
> 
> $ type mv
> mv is /bin/mv
> 
> $ alias | grep mv
> 
> $ which mv
> /bin/mv
> 
> $ umask
> 0022
> 
> I don't know, why we see
> r--r--r--  tb/staff for .git/objects/info/commit-graph
> 
> But, the "-r--r--r--" may be part of the problem, here is another one:
> $ find . -name commit-graph -print0 | xargs -0 ls -l
> -r--r--r--  1 tb  staff  1792 May  2 12:12 ./trash directory.t5318-commit-graph/bare/objects/info/commit-graph
> (And some more 6 in total. All with -r--r--r--)
> 
> Which means, yes, t5318 does not pass either:
> t5318-commit-graph.sh not ok 101 - reader notices too-small oid fanout chunk
> t5318-commit-graph.sh not ok 102 - reader notices fanout/lookup table mismatch
> t5318-commit-graph.sh not ok 103 - reader notices out-of-bounds fanout
> t5318-commit-graph.sh not ok 104 - reader notices too-small commit data chunk
> t5318-commit-graph.sh not ok 105 - reader notices out-of-bounds extra edge
> t5318-commit-graph.sh not ok 106 - reader notices too-small generations chunk
> 
> Same problem here:
> ++ mv full/.git/objects/info/commit-graph.tmp full/.git/objects/info/commit-graph
> override r--r--r--  tb/staff for full/.git/objects/info/commit-graph? (y/n [n]) not overwritten

'mv' in macOS doesn't conform to POSIX, and asks for confirmation when
the destination exists (is read-only?) even without '-i' and even when
its stdin is not a terminal, which it won't get as its stdin in our
test suite is redirected from /dev/null.

This is a recurring issue, see e.g.:

  https://public-inbox.org/git/[email-masked]/
  c20d4d702f (t1450: use "mv -f" within loose object directory, 2017-01-24)

'mv -f' did the trick in the past.