Re: [PATCH v10] setup: improve error diagnosis for invalid .git files
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 25, 2026, 02:50 UTC
- Message-ID
- <xmqq8qchcz9w.fsf@gitster.g>
- In-Reply-To
- <e48c68ce-de45-4d45-8bd2-1307686a8910@gmail.com>
Tian Yuchen <a3205153416@gmail.com> writes:
Show 8 quoted lines
> 1. Perhaps I took it literally, but as far as the original intent > goes, shouldn't 'read_gitfile_gently()' be solely responsible for > *opening a .git file and parsing the gitdir: <path> format*? However, it > currently executes 'stat()', checks 'S_ISDIR', checks 'S_ISREG', handles > missing components, and *then* attempts to parse. Do we need an 'enum > git_componet_type git_componet(cost char *path)' which returns pure > filesystem states, then parse it with 'parse_gitfile_format(const char > *path)'? I don't know.
Sorry, but I do not see what such a change buys us.
> 2. Let's say, when stat() encounters a EACCES when cheaking a > restricted sub-folder. Git funnels this into STAT_FAILED and > subsequently invokes die(), which calls exit().
Yes all this happens in repository set-up which should happen very early in the process, no?
> I'm thinking of > libification: if a long running multi threaded git server encounters a > permission-denied directory, is killing the entire process the expected > behavior?
It is a bug in the way you wrote that multi-threaded git server, no?
We have the "_gently" variant for such a use case, and I do not think we expect the normal single-process git start-up sequence should be reused there.