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

2015-02-03 Thread Junio C Hamano
Jeff King writes: > On Tue, Feb 03, 2015 at 01:40:12PM -0800, Junio C Hamano wrote: > >> Jeff King 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 poin

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

2015-02-03 Thread Jeff King
On Tue, Feb 03, 2015 at 01:40:12PM -0800, Junio C Hamano wrote: > Jeff King 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

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

2015-02-03 Thread Junio C Hamano
Jeff King 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.

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

2015-02-03 Thread Jeff King
On Tue, Feb 03, 2015 at 01:23:15PM -0800, Junio C Hamano wrote: > Jeff King writes: > > > Right, I do not think these tests will _fail_ when the filesystem does > > not support symlinks. But nor are they actually testing anything > > interesting. They would pass on such a system even without you

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

2015-02-03 Thread Junio C Hamano
Jeff King writes: > Right, I do not think these tests will _fail_ when the filesystem does > not support symlinks. But nor are they actually testing anything > interesting. They would pass on such a system even without your patch, > as we would fail to apply even the symlink creation part of the

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

2015-02-03 Thread Jeff King
On Tue, Feb 03, 2015 at 12:23:28PM -0800, Junio C Hamano wrote: > > By the way, does this patch (and the other symlink-escape ones) need to > > be marked with the SYMLINKS prereq? For a pure-index application, it > > should work anywhere, but I have a feeling that this "git apply patch" > > may tr

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

2015-02-03 Thread Junio C Hamano
Jeff King writes: > On Mon, Feb 02, 2015 at 03:27:27PM -0800, Junio C Hamano wrote: > >> +test_expect_failure 'symlink escape via ..' ' >> +{ >> +mkpatch_symlink tmp .. && >> +mkpatch_add tmp/foo ../foo >> +} >patch && >> +test_must_fail git apply patch && >> +

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

2015-02-02 Thread Torsten Bögershausen
If I am allowed to to some load thinking: The commit msh header says: reject input that touches outside $cwd The commit message says: By default, a patch that affects outside the working area And the new command line option is this: --unsafe-paths (Which may be a good choice to pretend peo

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

2015-02-02 Thread Jeff King
On Mon, Feb 02, 2015 at 03:27:27PM -0800, Junio C Hamano wrote: > +test_expect_failure 'symlink escape via ..' ' > + { > + mkpatch_symlink tmp .. && > + mkpatch_add tmp/foo ../foo > + } >patch && > + test_must_fail git apply patch && > + test_path_is_missing

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

2015-02-02 Thread Jeff King
On Mon, Feb 02, 2015 at 03:27:27PM -0800, Junio C Hamano wrote: > By default, a patch that affects outside the working area is > rejected as a mistake (or a mischief); Git itself does not create > such a patch, unless the user bends backwards and specifies a > non-standard prefix to "git diff" and

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

2015-02-02 Thread Junio C Hamano
By default, a patch that affects outside the working area is rejected as a mistake (or a mischief); Git itself does not create such a patch, unless the user bends backwards and specifies a non-standard prefix to "git diff" and friends. When `git apply` is used without either `--index` or `--cached