Re: nd/magic-pathspec exposes breakage in git-add--interactive on Windows
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Aug 29, 2013, 09:47 UTC
- Message-ID
- <CACsJy8B50Xb=S7wp=2H7NHPoM52XXZgBbygTJahFyRzuqT-=HQ@mail.gmail.com>
- In-Reply-To
- <521EF02A.2020300@viscovery.net>
On Thu, Aug 29, 2013 at 1:54 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 43 quoted lines
> With nd/magic-pathspec I get the following failure on Windows in
> t2016-checkout-patch.sh:
>
> expecting success:
> set_state dir/foo work head &&
> # the third n is to get out in case it mistakenly does not apply
> (echo y; echo n; echo n) | (cd dir && git checkout -p foo) &&
> verify_saved_state bar &&
> verify_state dir/foo head head
>
> ==== xx.
> ==== 1d.
> ==== 10e.
> msys does not support: :(prefix:4)dir/foo
> not ok 13 - path limiting works: foo inside dir
>
> The error message 'msys does not support...' originates from this function
> in git-add--interactive.perl (which is invoked from checkout -p):
>
> sub run_cmd_pipe {
> if ($^O eq 'MSWin32' || $^O eq 'msys') {
> my @invalid = grep {m/[":*]/} @_;
> die "$^O does not support: @invalid\n" if @invalid;
> my @args = map { m/ /o ? "\"$_\"": $_ } @_;
> return qx{@args};
> } else {
> my $fh = undef;
> open($fh, '-|', @_) or die;
> return <$fh>;
> }
> }
>
> It looks like on Windows we disallow arguments that contain double-quote,
> colon, or asterisk, and otherwise wrap arguments in double-quotes if they
> contain space. Then pass them through qx{}, which I can only guess what it
> does.
>
> This code was introduced in 21e9757e (Hack git-add--interactive to make it
> work with ActiveState Perl, 2007-08-01). The commit message has the
> general statement "It wont work for arguments with special characters
> (like ", : or *)), which I do not know how to interpret: Does ActiveState
> Perl not work with special charactoers, or Windows? Because the latter is
> definitely not true.If it indeed does not work with ActiveState Perl, we still have a chance to make it :(prefix=4)dir/foo, assuming '=' does not fall to the same category as ':'
Show 8 quoted lines
> > Can we be more permissive in the 'my @invalid' check without breaking > ActiveState Perl? > > BTW, there is a similar failure in t7105-reset-patch.sh, which invokes > 'git reset -p', but I haven't investigate further. > > -- Hannes
-- Duy