git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: new platform & S_IFGITLINK problem

From
AHAlan Hourihane <alanh@fairlite.co.uk>
Date
May 2, 2010, 09:39 UTC
Message-ID
<1272793169.13488.1315.camel@jetpack.demon.co.uk>
In-Reply-To
<7vfx2b2ft5.fsf@alter.siamese.dyndns.org>
On Sat, 2010-05-01 at 19:33 -0700, Junio C Hamano wrote:
Show 32 quoted lines
> Alan Hourihane <alanh@fairlite.co.uk> 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.
No problem. Thanks for taking the challenge and sorting it out.
Let me know if there's anywhere I can help, test, or debug.
Thanks again!
Alan.
Previous: Junio C HamanoNext: Linus Torvalds
Message 3 of 17 in “new platform & S_IFGITLINK problem”
  1. Alan HourihaneMay 1, 2010
  2. Junio C HamanoMay 2, 2010
  3. Alan HourihaneMay 2, 2010
  4. Linus TorvaldsMay 4, 2010
  5. Linus TorvaldsMay 4, 2010
  6. Andreas EricssonMay 4, 2010
  7. Linus TorvaldsMay 4, 2010
  8. Junio C HamanoMay 4, 2010
  9. Alan HourihaneMay 4, 2010
  10. Alan HourihaneJul 22, 2010
  11. Junio C HamanoJul 25, 2010
  12. Alan HourihaneJul 25, 2010
  13. Ævar Arnfjörð BjarmasonAug 2, 2010
  14. Alan HourihaneAug 2, 2010
  15. Ævar Arnfjörð BjarmasonAug 2, 2010
  16. Jonathan NiederMay 5, 2010
  17. Alan HourihaneMay 5, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.