Subject: Re: [PATCH v2 1/4] apply: reject input that touches outside $cwd

From: Jeff King <[email-masked]>
Date: Tue, 3 Feb 2015 16:50:43 -0500

On Tue, Feb 03, 2015 at 01:40:12PM -0800, Junio C Hamano wrote:

> Jeff King <[email-masked]> writes:
> 
> > But wouldn't we still fail writing "foo/bar" at that point if "foo" is a
> > regular file (again, we should never do this, but that is the point of
> > the test).
> 
> The point of the test is not to create foo, whether it is a symlink
> or an emulating regular file, in the first place.

I thought the point was not to create "../bar", when "foo" points to
"..". I agree that the way you have implemented it is that we would
never even write "foo", and the test checks for that, but to me that is
the least interesting bit of what is being tested. Crossing a symlink
boundary and escaping from the tree are interesting, and the atomicity
is a side note. We could also realize that treating "foo" as a file
would fail and cancel the whole operation atomically, too.

But I think we are getting into contrasting our mental models, which is
probably not productive. I am OK with leaving it without the SYMLINKS
flag, as it should pass on systems that do not handle symlinks. And if
it does not, then that will be a good cross-check that our analysis was
sane. :)

-Peff