From: Jakub Narebski <jnareb@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Robert Schiele <rschiele@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Lea Wiemann <lewiemann@gmail.com>
Subject: Re: [PATCH] change Perl syntax to support Perl 5.6
Date: Sat, 30 Aug 2008 22:37:15 +0200 [thread overview]
Message-ID: <200808302237.17017.jnareb@gmail.com> (raw)
In-Reply-To: <20080830183949.GA16415@coredump.intra.peff.net>
On Sat, 30 August 2008, Jeff King wrote:
> On Sat, Aug 30, 2008 at 08:34:13PM +0200, Robert Schiele wrote:
>
> > If there are problems with that change I recommend just using my
> > initial patch changing the documentation to require Perl 5.8 since my
> > interest in Perl 5.6 support is not big enough to mess around with
> > quoting all that stuff. If someone really needs this he or she can
> > still do it --- it should be not too difficult.
First, IIRC gitweb requires Perl 5.8 _anyway_ because of unicode stuff.
> I think it is as simple as:
>
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index da768ee..4ee6f89 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -61,7 +61,7 @@ sub run_cmd_pipe {
> return qx{@args};
> } else {
> my $fh = undef;
> - open($fh, '-|', @_) or die;
> + open($fh, '-|', join(' ', map { quotemeta($_) } @_)) or die;
> return <$fh>;
> }
> }
>
> But I didn't do any testing beyond checking that "git add -i 'file with
> spaces'" which was broken by your patch now works at all.
No, you would need something like this code from gitweb.perl (used in
very rare cases where list form of open cannot be used, which means
when we need pipeline like for compressed snapshot, or redirecting
stdout and/or stderr to /dev/null like when getting type of possibly
not existing object in git_object)
# quote the given arguments for passing them to the shell
# quote_command("command", "arg 1", "arg with ' and ! characters")
# => "'command' 'arg 1' 'arg with '\'' and '\!' characters'"
# Try to avoid using this function wherever possible.
sub quote_command {
return join(' ',
map( { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ ));
}
Or you can use "open $fd, '-|'" to fork, an "manually" exec/system.
--
Jakub Narebski
Poland
next prev parent reply other threads:[~2008-08-30 20:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-30 17:39 [PATCH] change Perl syntax to support Perl 5.6 Robert Schiele
2008-08-30 18:00 ` Jeff King
2008-08-30 18:06 ` Junio C Hamano
2008-08-30 18:13 ` Jeff King
2008-08-30 18:34 ` Robert Schiele
2008-08-30 18:39 ` Jeff King
2008-08-30 20:37 ` Jakub Narebski [this message]
2008-08-30 21:21 ` Robert Schiele
2008-08-31 5:35 ` Avery Pennarun
2008-08-31 13:37 ` Randal L. Schwartz
2008-08-31 16:27 ` Junio C Hamano
2008-08-31 18:29 ` Avery Pennarun
2008-08-31 20:23 ` Jakub Narebski
2008-08-31 20:34 ` Petr Baudis
2008-09-01 3:57 ` H. Peter Anvin
2008-09-01 4:22 ` Robert Schiele
2008-09-01 13:06 ` Tom G. Christensen
2008-09-04 17:28 ` Brandon Casey
2008-09-05 6:34 ` Tom G. Christensen
2008-08-31 20:55 ` Jakub Narebski
2008-09-01 1:52 ` Jay Soffian
2008-09-01 21:42 ` Alex Riesen
2008-09-02 0:23 ` Avery Pennarun
2008-09-02 17:50 ` Avery Pennarun
2008-08-30 20:20 ` Junio C Hamano
2008-08-31 13:35 ` Randal L. Schwartz
2008-08-31 19:54 ` Ask Bjørn Hansen
2008-09-01 1:22 ` Junio C Hamano
2008-09-01 1:48 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200808302237.17017.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=lewiemann@gmail.com \
--cc=peff@peff.net \
--cc=rschiele@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).