From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9367721421 for ; Wed, 30 Jan 2019 04:44:32 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 08/11] solvergit: do not show full path names to "git apply" Date: Wed, 30 Jan 2019 04:44:27 +0000 Message-Id: <20190130044430.28189-9-e@80x24.org> In-Reply-To: <20190130044430.28189-1-e@80x24.org> References: <20190130044430.28189-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: "git apply" will warn about whitespace with the full path of the patch, which will expose the $TMPDIR environment to users over HTTP(S). This change breaks compatibility with git pre-1.8.5, again; but that was released in late-2013; so hopefully everybody is on newer versions. --- lib/PublicInbox/SolverGit.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index 24d9da2..891cde2 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -389,8 +389,8 @@ sub do_git_apply ($) { my $patches = $self->{patches}; # we need --ignore-whitespace because some patches are CRLF - my @cmd = qw(git apply --cached --ignore-whitespace - --whitespace=warn --verbose); + my @cmd = (qw(git -C), $dn, qw(apply --cached --ignore-whitespace + --whitespace=warn --verbose)); my $len = length(join(' ', @cmd)); my $total = $self->{tot}; my $di; # keep track of the last one for "git ls-files" @@ -400,8 +400,7 @@ sub do_git_apply ($) { $di = shift @$patches; dbg($self, "\napplying [$i/$total] " . di_url($self, $di) . "\n" . join('', @{$di->{hdr_lines}})); - my $pn = $total + 1 - $i; - my $path = "$dn/$pn"; + my $path = $total + 1 - $i; $len += length($path) + 1; push @cmd, $path; } while (@$patches && $len < $ARG_SIZE_MAX); -- EW