git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Johannes SixtNext: Alex Riesen
Message 2 of 10 in “nd/magic-pathspec exposes breakage in git-add--interactive on Windows”
  1. Johannes SixtAug 29, 2013
  2. Duy NguyenAug 29, 2013
  3. Alex RiesenAug 29, 2013
  4. Turn off pathspec magic on "{checkout,reset,add} -p" on native Windows buildsNguyễn Thái Ngọc Duy, Sep 1, 2013
  5. Johannes SixtSep 2, 2013
  6. Duy NguyenSep 2, 2013
  7. Johannes SixtSep 2, 2013
  8. Duy NguyenSep 2, 2013
  9. add--interactive: fix external command invocation on WindowsJohannes Sixt, Sep 4, 2013
  10. Duy NguyenSep 4, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.