git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* nd/magic-pathspec exposes breakage in git-add--interactive on Windows
@ 2013-08-29  6:54 Johannes Sixt
  2013-08-29  9:47 ` Duy Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Johannes Sixt @ 2013-08-29  6:54 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Git Mailing List, Nguyễn Thái Ngọc Duy

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.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-09-04 12:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-29  6:54 nd/magic-pathspec exposes breakage in git-add--interactive on Windows Johannes Sixt
2013-08-29  9:47 ` Duy Nguyen
2013-08-29 13:01 ` Alex Riesen
2013-09-01  2:08 ` [PATCH] Turn off pathspec magic on "{checkout,reset,add} -p" on native Windows builds Nguyễn Thái Ngọc Duy
2013-09-02  6:42   ` Johannes Sixt
2013-09-02  9:30     ` Duy Nguyen
2013-09-02 10:41       ` Johannes Sixt
2013-09-02 11:56         ` Duy Nguyen
2013-09-04  7:24           ` [PATCH] add--interactive: fix external command invocation on Windows Johannes Sixt
2013-09-04 12:02             ` Duy Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).