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

Re: [PATCH] Use "-f" when adding files with odd names in t9200.

From
Junio C Hamano <junkio@cox.net>
Date
Feb 3, 2007, 23:50 UTC
Message-ID
<7vlkje243u.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<A9623793-111E-47F7-9709-1D569333C40C@silverinsanity.com>
Brian Gernhardt <benji@silverinsanity.com> writes:
Show 9 quoted lines
> On Feb 3, 2007, at 3:51 PM, Junio C Hamano wrote:
>
>> A filesystem that reports success on creat(path) and then does
>> not return that path to later readdir() from that directory is
>> broken from git's point of view.  At least that has been the
>> definition so far.
>
> I agree, it's fairly idiotic and obtuse.  By using the great Google,
> I've seen lots of other people complaining about it as well.
I am not sure if we are really agreeing, but I'll let it pass.
> "git add ." works just fine, as it reads the name of the file from
> disk which is already in the form HFS+ accepts.  The only confusion
> exists when comparing data from the user to data from disk.
I wonder even if that is true.

Luckily or unluckily, I do not have access to a system with broken readdir() vs creat() confusion, so I cannot test it myself, but I suspect that this sequence may not work as expected:

	#!/bin/sh
	pathname='a pathname that canonicalize differently from original'
	rm -fr testrepo
	mkdir testrepo
        cd testrepo
        git init-db
	echo hello >"$pathname"
        git add -f .
        git ls-files -s "$pathname"

If my reading of what you said is correct, then in the above sequence:

 (1) The shell creates, via redirection of output of echo, a file
     but using canonicalized string, which is different from
     what the user gave;
 (2) "git add" will ask readdir(2) to get inventory of files in
     the working directory, and grabs canonicalized string;
 (3) "git add" uses that canonicalized string, open(2)s, mmap(2)s and
     hashes the blob contents and registers that object name
     under the canonicazlied string in the index;
 (4) "git ls-files" tries to look up the index with the string
     user used to create the file in (1), which is without the
     canonicalization.

I think it is fairly idiotic and obtuse for a filesystem to treat pathnames anything but a random sequence of bytes that is slash separated and NUL terminated. I would need a really hard convincing to buy any path munging on the git side to match whatever a stupid filesystem does, especially because we do not live in the ideal Unicode/utf-8 only world.

Previous: Brian GernhardtNext: Junio C Hamano
Message 9 of 17 in “t9200 still failing...”
  1. Brian GernhardtFeb 3, 2007
  2. Wolfgang FischerFeb 3, 2007
  3. Brian GernhardtFeb 3, 2007
  4. Use "-f" when adding files with odd names in t9200.Brian Gernhardt, Feb 3, 2007
  5. Junio C HamanoFeb 3, 2007
  6. Brian GernhardtFeb 3, 2007
  7. Junio C HamanoFeb 3, 2007
  8. Brian GernhardtFeb 3, 2007
  9. Junio C HamanoFeb 3, 2007
  10. Junio C HamanoFeb 4, 2007
  11. Shawn O. PearceFeb 4, 2007
  12. Brian GernhardtFeb 4, 2007
  13. Brian GernhardtFeb 4, 2007
  14. Junio C HamanoFeb 5, 2007
  15. Brian GernhardtFeb 5, 2007
  16. Brian GernhardtFeb 6, 2007
  17. Brian GernhardtFeb 3, 2007

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.