Re: [PATCH] Make Git accept absolute path names for files within the work tree
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Dec 4, 2007, 22:52 UTC
- Message-ID
- <alpine.LFD.0.9999.0712041444090.13796@woody.linux-foundation.org>
- In-Reply-To
- <20071204220840.GA3340@coredump.intra.peff.net>
On Tue, 4 Dec 2007, Jeff King wrote:
> > It is more expensive, though we will be doing it once per user-supplied > pathspec, so I don't know that it will actually have an impact.
Well, I'm more worried about just bugs, actually.
Doing this right is actually rather hard. For example, our current "make_absolute_path()" is simply not very good, and it's almost impossible to *make* it very good.
Why? It relies on being able to get the current cwd, which isn't always even possible on all systems. What about unreadable directories? What about just so *deep* directories, that the cwd doesn't fit in the 1kB allocated for it? Both do happen (people use executable but non-readable directories for security sometimes). I'm also almost certain that you can confuse it by renaming directories while that thing is running, etc etc.
IOW, that whole thing is simply a bug waiting to happen. The fact that it apparently *always* runs whether needed or not just seems to make it worse (ie if we already know our cwd, and the absolute path we have already has that as a prefix, just strip it off, don't try to do anything complex, and leave the complex and fragile cases for the odd-ball when the simple approach doesn't work)
Linus