v2.46.0-rc0 test failures on cygwin
From: Ramsay Jones <hidden>
Date: 2024-07-16 19:49:00
The 'Test Summary Report' for the v2.46.0-rc0 test run, on cygwin, includes:
...
t1460-refs-migrate.sh (Wstat: 256 (exited 1) Tests: 30 Failed: 9)
Failed tests: 8-15, 29
Non-zero exit status: 1
...
Looking at the test output directly, we see:
$ pwd
/home/ramsay/git
$ cd t
$ make clean
rm -f -r 'chainlinttmp'
rm -f -r 'trash directory'.*
rm -f -r valgrind/bin
rm -f -r 'test-results'
rm -f .prove
$ ./t1460-refs-migrate.sh -v -i
...
ok 7 - files -> reftable: migration with worktree fails
expecting success of 1460.8 'files -> reftable: unborn HEAD':
test_when_finished "rm -rf repo" &&
git init --ref-format=$from_format repo &&
test_migration repo "$to_format"
Initialized empty Git repository in /home/ramsay/git/t/trash directory.t1460-refs-migrate/repo/.git/
error: could not link file '.git/ref_migration.sr9pEF/reftable' to '.git/reftable': Permission denied
migrated refs can be found at '.git/ref_migration.sr9pEF'
not ok 8 - files -> reftable: unborn HEAD
#
# test_when_finished "rm -rf repo" &&
# git init --ref-format=$from_format repo &&
# test_migration repo "$to_format"
#
1..8
$
Note that all of the errors in this test look similar to this one (ie. when
rename()-ing the 'migrated' reftable directory to .git/reftable we get an
'Permission denied' error). So the error message is from line 2672 of refs.c
in the move_files() function.
Let's have a quick look at the test directory:
$ cd trash\ directory.t1460-refs-migrate/
$ ls
err expect repo/
$ cd repo
$ ls -l .git
total 7.0K
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 branches/
-rw-r--r-- 1 ramsay None 86 Jul 16 19:53 config
-rw-r--r-- 1 ramsay None 73 Jul 16 19:53 description
-rw-r--r-- 1 ramsay None 25 Jul 16 19:53 HEAD
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 hooks/
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 info/
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 objects/
drwx------ 1 ramsay None 0 Jul 16 19:53 ref_migration.sr9pEF/
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 refs/
Now try to finish the migration by hand:
$ mv .git/ref_migration.sr9pEF/reftable .git/reftable
Hmm, note no error; of course, the mv command may well do much more than
the rename() library function, so they are not necessarily equivalent.
$ ls -l .git
total 7.0K
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 branches/
-rw-r--r-- 1 ramsay None 86 Jul 16 19:53 config
-rw-r--r-- 1 ramsay None 73 Jul 16 19:53 description
-rw-r--r-- 1 ramsay None 25 Jul 16 19:53 HEAD
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 hooks/
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 info/
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 objects/
drwx------ 1 ramsay None 0 Jul 16 19:55 ref_migration.sr9pEF/
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 refs/
drwxr-xr-x 1 ramsay None 0 Jul 16 19:53 reftable/
$
$ rm -rf .git/ref_migration.sr9pEF/
$ git branch -v
fatal: failed to resolve HEAD as a valid ref
$ ls -l .git/reftable
total 2.0K
-rw-r--r-- 1 ramsay None 124 Jul 16 19:53 0x000000000001-0x000000000001-64e987ec.ref
-rw-r--r-- 1 ramsay None 43 Jul 16 19:53 tables.list
$ xxd .git/reftable/0x000000000001-0x000000000001-64e987ec.ref
00000000: 5245 4654 0100 1000 0000 0000 0000 0001 REFT............
00000010: 0000 0000 0000 0001 7200 0038 0023 4845 ........r..8.#HE
00000020: 4144 000f 7265 6673 2f68 6561 6473 2f6d AD..refs/heads/m
00000030: 6169 6e00 001c 0001 5245 4654 0100 1000 ain.....REFT....
00000040: 0000 0000 0000 0001 0000 0000 0000 0001 ................
00000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
00000070: 0000 0000 0000 0000 b6bf f78a ............
$
So, the HEAD ref was referring to refs/heads/main.
$ pwd
/home/ramsay/git/t/trash directory.t1460-refs-migrate/repo
$ git init --ref-format=reftable
fatal: attempt to reinitialize repository with different reference storage format
$ xxd .git/refs/heads
00000000: 7468 6973 2072 6570 6f73 6974 6f72 7920 this repository
00000010: 7573 6573 2074 6865 2072 6566 7461 626c uses the reftabl
00000020: 6520 666f 726d 6174 0a e format.
$
$ git branch -v
fatal: failed to resolve HEAD as a valid ref
$
Hmm, so quite broken :)
Maybe the order of some of the actions in repo_migrate_ref_storage_format() may
need to be re-thought! ;)
The 'man 3 rename' is not very enlightening; 'The conditions for failure depend
on the host operating system.'
Unfortunately, I don't have any (well much) spare time to dig further into
this at the moment, so I thought I should at least report it here for others
to hopefully find a solution.
ATB,
Ramsay Jones