Re: new platform & S_IFGITLINK problem

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

 



Alan Hourihane <alanh@xxxxxxxxxxxxxx> writes:

> Just joined as I'm compiling git on a new platform and wondered if
> someone can help solve a problem with the definition of S_IFGITLINK.

Yikes.  The current codebase pretty much assumes that IFREG is 0100000,
IFDIR 0040000, and IFLNK 0120000, and the bits read from "struct stat" and
the mode bits we store in the index and tree objects are interchangeable.

Yes, that assumption is a gross POSIX violation but we so far haven't seen
any platform that matters in real life that assigns the IFMT bits
differently.

We would need to:

 (1) rename S_IFGITLINK to GIT_S_IFMODULE;

 (2) define GIT_S_IF{REG,DIR,LNK} as 0100000, 0040000, and 0120000;

 (3) write MODE_SYSTEM_TO_GIT() macro to convert from S_IF{REG,DIR,LNK} we
     read from struct stat to the "canonical" GIT_S_IF{REG,DIR,LNK}
     values; and

 (4) change all the code that read mode from struct stat and use it to
     first use MODE_SYSTEM_TO_GIT().

Currently 'git grep -e "S_IF[A-Z]" -e "struct stat"' reports around 250
hits, so it is not infeasible amount of work, but it is not a trivial and
mechanical replacement, either.  I or somebody need to set aside a block
of time to do this clean-up and audit the result.

Thanks for a report.
--
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]