Thread (12 messages) flat view 12 messages, 6 authors, 2016-06-15

Re: [PATCH] Make Git accept absolute path names for files within the work tree

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:56

Possibly related (same subject, not in this thread)


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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help