Re: t1450-fsck (sometimes/often) failes on Mac OS X
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 2, 2012, 21:01 UTC
- Message-ID
- <7v4nmc7fmz.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <506B110B.2050802@web.de>
Torsten Bögershausen <tboegi@web.de> writes:
Show 28 quoted lines
> With help of Junio's comments I probably found the reason why the test
> behaves differently:
>
> The objects are checked in a certain order, based on the inode number.
>
> Which seems to be the same on most machines: when files are created
> in a certain order, then the inode numbers are in the same order.
>
> When the inode numbering changes for reasons known to the file system,
> the order changes and fsck takes a different code path.
>
> To provoke the error, the following helped at my Linux box:
>
> diff --git a/builtin/fsck.c b/builtin/fsck.c
> index a710227..bba8082 100644
> --- a/builtin/fsck.c
> +++ b/builtin/fsck.c
> @@ -373,7 +373,7 @@ static struct {
>
> static int ino_compare(const void *_a, const void *_b)
> {
> - const struct sha1_entry *a = _a, *b = _b;
> + const struct sha1_entry *a = _b, *b = _a;
> unsigned long ino1 = a->ino, ino2 = b->ino;
> return ino1 < ino2 ? -1 : ino1 > ino2 ? 1 : 0;
> }
>
> The bad news: I haven't found the time to prepare a fix.Thanks for a reproduction. Yes, the test t1450.13 is expecting too much.
If it finds the $sha blob first and then looks at $tag tag, then it will notice that the tag is pointing at a blob but claims it must be a commit. If it finds the $tag tag first, it will remember that the tag claimed $sha must be a commit, and when later it sees $sha, it finds that it is not of the type it is expecting (namely, a commit), and says "the object called $sha is broken".
So "test_must_fail git fsck --tags" is correct. The fsck must find the breakage either way.
The last piece to expect "error in tag.*broken links" in the output is wrong. Probably we should remove the misguided check and end it with "test_must_fail git fsck --tags".