Re: [msysGit] Re: Sparse checkout not working as expected (colons in filenames on Windows)

2015-03-25 Thread Johannes Schindelin
Hi Duy,

On 2015-03-25 01:46, Duy Nguyen wrote:
 On Wed, Mar 25, 2015 at 6:50 AM, Philip Oakley philipoak...@iee.org wrote:

 That said, the final error (which I'd missed in the earlier post) is:
 fatal: make_cache_entry failed for path 'ifcfg-eth0:0'

 This is on the Windows (pre-compiled msysgit at v1.9.5) Git bash, so could
 be a catch path in that code for make_cache_entry (I've not checked the code
 yet). So at the moment it doesn't look like sparse checkout can be used to
 avoid colons in windows on-disk files based on the current code.
 
 Both of your commands below fail by the same function, verify_path()
 because of this msysgit commit 2e2a2d1 (NTFS: Prevent problematic
 paths from being checked out - 2014-12-10). I guess that check is a
 bit too strong, it should apply when new index entries are created
 from worktree (not from a tree)..

Oh, right, that check needs some relaxing. But certainly in a different way: 
you *definitely* want to prevent attacks from the outside, and those originate 
from the *tree*.

What we need to do instead is to relax the check to apply only if we are really 
going to write out that file, not when it is skipped.

Thanks,
Johannes
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [msysGit] Re: Sparse checkout not working as expected (colons in filenames on Windows)

2015-03-25 Thread Duy Nguyen
On Wed, Mar 25, 2015 at 1:39 PM, Johannes Schindelin
johannes.schinde...@gmx.de wrote:
 Hi Duy,

 On 2015-03-25 01:46, Duy Nguyen wrote:
 On Wed, Mar 25, 2015 at 6:50 AM, Philip Oakley philipoak...@iee.org wrote:

 That said, the final error (which I'd missed in the earlier post) is:
 fatal: make_cache_entry failed for path 'ifcfg-eth0:0'

 This is on the Windows (pre-compiled msysgit at v1.9.5) Git bash, so could
 be a catch path in that code for make_cache_entry (I've not checked the code
 yet). So at the moment it doesn't look like sparse checkout can be used to
 avoid colons in windows on-disk files based on the current code.

 Both of your commands below fail by the same function, verify_path()
 because of this msysgit commit 2e2a2d1 (NTFS: Prevent problematic
 paths from being checked out - 2014-12-10). I guess that check is a
 bit too strong, it should apply when new index entries are created
 from worktree (not from a tree)..

 Oh, right, that check needs some relaxing. But certainly in a different way: 
 you *definitely* want to prevent attacks from the outside, and those 
 originate from the *tree*.

 What we need to do instead is to relax the check to apply only if we are 
 really going to write out that file, not when it is skipped.

Yeah. In fact if you do this, not checking out  files that can't be or
not safe to be checked out, then the ifcfg-eth0:0 problem that Phillip
wanted to avoid using sparse checkout is also gone.
-- 
Duy
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Sparse checkout not working as expected (colons in filenames on Windows)

2015-03-24 Thread Philip Oakley

From: Duy Nguyen pclo...@gmail.com
On Fri, Mar 20, 2015 at 6:07 AM, Philip Oakley philipoak...@iee.org 
wrote:
Hi, I was expecting that sparse checkout could be used to avoid the 
checking
out, by git, of files which have colons in their name into the 
worktree when

on Windows.

Yue Lin Ho reported on the Msygit list [1] that he had a repo where 
there
was already committed a file with a colon in it's name, which was a 
needed
file and had been committed by a Linux user. The problem was how to 
work
with that repo on a Windows box where such a file is prohibited to 
exist on
the FS (hence the expectation that a sparse checkout would suffice). 
Yue has

created a short test repo [2]

Even after getting the pathspec escaping right, I still haven't been 
able to

make this expected behaviour work [3].

Am I wrong to expect that sparse checkout (and the skip-worktree bit) 
can be
used to avoid files with undesirable filenames hitting the OS's file 
system?


If it should be OK, what's the correct recipe?

--
Philip

[1]
https://groups.google.com/forum/?hl=en_US?hl%3Den#!topic/msysgit/D4HcHRpxPgU
How to play around with the filename with colon on Windows?
[2] Test repo https://github.com/t-pascal/tortoisegit-colons

[3] test sequence::
$ mkdir colons  cd colons
$ git clone -n https://github.com/t-pascal/tortoisegit-colons
$ cd tortoisegit-colons/
$ git config core.sparseCheckout true
$ cat .git/info/sparse-checkout # external editor
/*
!ifcfg-eth0\:0


Colons have no special meaning in gitignore rules and therefore need
not be escaped. The backslash is considered a literal character in
this case, probably not what you want.


$ git update-index --skip-worktree -- ifcfg-eth0\:0
Ignoring path ifcfg-eth0:0
$ git checkout -b test 7f35d34bc6160cc # tip commit, we are still 
unborn!

error: Invalid path 'ifcfg-eth0:0
D   ifcfg-eth0:0
Switched to a new branch 'test'

--
I've corrected the sparse-checkout, but won't the command line 'git 
update-index --skip-worktree' will still need it? (demo commands below)


That said, the final error (which I'd missed in the earlier post) is:
fatal: make_cache_entry failed for path 'ifcfg-eth0:0'

This is on the Windows (pre-compiled msysgit at v1.9.5) Git bash, so 
could be a catch path in that code for make_cache_entry (I've not 
checked the code yet). So at the moment it doesn't look like sparse 
checkout can be used to avoid colons in windows on-disk files based on 
the current code.

--
Philip

Philip@PHILIPOAKLEY /d/Git_repos/colons
$ cd tortoisegit-colons/

Philip@PHILIPOAKLEY /d/Git_repos/colons/tortoisegit-colons (test)
$ git update-index --skip-worktree -- ifcfg-eth0\:0
Ignoring path ifcfg-eth0:0

Philip@PHILIPOAKLEY /d/Git_repos/colons/tortoisegit-colons (test)
$ git reset
error: Invalid path 'ifcfg-eth0:0'
fatal: make_cache_entry failed for path 'ifcfg-eth0:0'

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Sparse checkout not working as expected (colons in filenames on Windows)

2015-03-24 Thread Duy Nguyen
On Wed, Mar 25, 2015 at 6:50 AM, Philip Oakley philipoak...@iee.org wrote:
 I've corrected the sparse-checkout, but won't the command line 'git
 update-index --skip-worktree' will still need it? (demo commands below)

A git checkout (without arguments) or read-trree -mu should attach
skip-worktree properly. You don't need to do it yourself.

 That said, the final error (which I'd missed in the earlier post) is:
 fatal: make_cache_entry failed for path 'ifcfg-eth0:0'

 This is on the Windows (pre-compiled msysgit at v1.9.5) Git bash, so could
 be a catch path in that code for make_cache_entry (I've not checked the code
 yet). So at the moment it doesn't look like sparse checkout can be used to
 avoid colons in windows on-disk files based on the current code.

Both of your commands below fail by the same function, verify_path()
because of this msysgit commit 2e2a2d1 (NTFS: Prevent problematic
paths from being checked out - 2014-12-10). I guess that check is a
bit too strong, it should apply when new index entries are created
from worktree (not from a tree)..

 --
 Philip

 Philip@PHILIPOAKLEY /d/Git_repos/colons
 $ cd tortoisegit-colons/

 Philip@PHILIPOAKLEY /d/Git_repos/colons/tortoisegit-colons (test)
 $ git update-index --skip-worktree -- ifcfg-eth0\:0
 Ignoring path ifcfg-eth0:0

 Philip@PHILIPOAKLEY /d/Git_repos/colons/tortoisegit-colons (test)
 $ git reset
 error: Invalid path 'ifcfg-eth0:0'
 fatal: make_cache_entry failed for path 'ifcfg-eth0:0'
-- 
Duy
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Sparse checkout not working as expected (colons in filenames on Windows)

2015-03-23 Thread Duy Nguyen
On Fri, Mar 20, 2015 at 6:07 AM, Philip Oakley philipoak...@iee.org wrote:
 Hi, I was expecting that sparse checkout could be used to avoid the checking
 out, by git, of files which have colons in their name into the worktree when
 on Windows.

 Yue Lin Ho reported on the Msygit list [1] that he had a repo where there
 was already committed a file with a colon in it's name, which was a needed
 file and had been committed by a Linux user. The problem was how to work
 with that repo on a Windows box where such a file is prohibited to exist on
 the FS (hence the expectation that a sparse checkout would suffice). Yue has
 created a short test repo [2]

 Even after getting the pathspec escaping right, I still haven't been able to
 make this expected behaviour work [3].

 Am I wrong to expect that sparse checkout (and the skip-worktree bit) can be
 used to avoid files with undesirable filenames hitting the OS's file system?

 If it should be OK, what's the correct recipe?

 --
 Philip

 [1]
 https://groups.google.com/forum/?hl=en_US?hl%3Den#!topic/msysgit/D4HcHRpxPgU
 How to play around with the filename with colon on Windows?
 [2] Test repo https://github.com/t-pascal/tortoisegit-colons

 [3] test sequence::
 $ mkdir colons  cd colons
 $ git clone -n https://github.com/t-pascal/tortoisegit-colons
 $ cd tortoisegit-colons/
 $ git config core.sparseCheckout true
 $ cat .git/info/sparse-checkout # external editor
 /*
 !ifcfg-eth0\:0

Colons have no special meaning in gitignore rules and therefore need
not be escaped. The backslash is considered a literal character in
this case, probably not what you want.

 $ git update-index --skip-worktree -- ifcfg-eth0\:0
 Ignoring path ifcfg-eth0:0
 $ git checkout -b test 7f35d34bc6160cc # tip commit, we are still unborn!
 error: Invalid path 'ifcfg-eth0:0
 D   ifcfg-eth0:0
 Switched to a new branch 'test'
-- 
Duy
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Sparse checkout not working as expected (colons in filenames on Windows)

2015-03-19 Thread Philip Oakley
Hi, I was expecting that sparse checkout could be used to avoid the 
checking out, by git, of files which have colons in their name into the 
worktree when on Windows.


Yue Lin Ho reported on the Msygit list [1] that he had a repo where 
there was already committed a file with a colon in it's name, which was 
a needed file and had been committed by a Linux user. The problem was 
how to work with that repo on a Windows box where such a file is 
prohibited to exist on the FS (hence the expectation that a sparse 
checkout would suffice). Yue has created a short test repo [2]


Even after getting the pathspec escaping right, I still haven't been 
able to make this expected behaviour work [3].


Am I wrong to expect that sparse checkout (and the skip-worktree bit) 
can be used to avoid files with undesirable filenames hitting the OS's 
file system?


If it should be OK, what's the correct recipe?

--
Philip

[1] 
https://groups.google.com/forum/?hl=en_US?hl%3Den#!topic/msysgit/D4HcHRpxPgU 
How to play around with the filename with colon on Windows?

[2] Test repo https://github.com/t-pascal/tortoisegit-colons

[3] test sequence::
$ mkdir colons  cd colons
$ git clone -n https://github.com/t-pascal/tortoisegit-colons
$ cd tortoisegit-colons/
$ git config core.sparseCheckout true
$ cat .git/info/sparse-checkout # external editor
/*
!ifcfg-eth0\:0
$ git update-index --skip-worktree -- ifcfg-eth0\:0
Ignoring path ifcfg-eth0:0
$ git checkout -b test 7f35d34bc6160cc # tip commit, we are still 
unborn!

error: Invalid path 'ifcfg-eth0:0
D   ifcfg-eth0:0
Switched to a new branch 'test'





--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html