Re: Git 2.8.1 fails test 32 of t7300-clean.sh, breaks profile build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for fixing the missing SANITY prerequisite Stefan.

As for the error handling logic in setup.c: is_nonbare_repository_dir
(was clean.c: is_git_repository) my reasoning is as follows:

READ_GITFILE_ERR_STAT_FAILED
READ_GITFILE_ERR_NOT_A_FILE:

When checking random paths for .git files these are the common error
modes, file is not there or it is a directory. This should not be
interpreted as a valid .git file.


READ_GITFILE_ERR_OPEN_FAILED
READ_GITFILE_ERR_READ_FAILED:

Here we found a .git file but could not open and read it to verify
that it is valid. Treating it as valid is the safest option for clean.
For resolve_gitlink_ref I think it maybe leads to the creation of a
redundant ref cache entries but I don't think this is a problem unless
someone has a huge amount of unreadable .git files lying around.


READ_GITFILE_ERR_TOO_LARGE:

File is absurdly large (1MB), very unlikely to be a valid .git file.


READ_GITFILE_ERR_INVALID_FORMAT
READ_GITFILE_ERR_NO_PATH:

File is malformed in some way, either the "gitdir:" prefix is missing
or the path is missing. Could theoretically be a corrupted .git file
but seems unlikely.


READ_GITFILE_ERR_NOT_A_REPO:

This is maybe a bit more suspicious. Here we have found a .git file,
it has the format "gitdir: some/path" but
is_git_directory("some/path") returned false, meaning that "some/path"
does not fulfill:

/*
 * Test if it looks like we're at a git directory.
 * We want to see:
 *
 *  - either an objects/ directory _or_ the proper
 *    GIT_OBJECT_DIRECTORY environment variable
 *  - a refs/ directory
 *  - either a HEAD symlink or a HEAD file that is formatted as
 *    a proper "ref:", or a regular file HEAD that has a properly
 *    formatted sha1 object name.
*/

Technically we don't have a valid .git file here but we have something
that really tries to be. I guess it is debatable what the correct
conservative choice is here and if it is the same for all callers.

/Erik
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]