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 8752E1F463; Sat, 4 Jan 2020 04:19:33 +0000 (UTC) Date: Sat, 4 Jan 2020 04:19:33 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/3] solver: allow literal '\r' character in diff lines Message-ID: <20200104041933.GA23490@dcvr> References: <20200104033415.17097-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200104033415.17097-1-e@80x24.org> List-Id: While filenames are escaped, the actual diff contents may contain an unescaped "\r" carriage return byte not in front of the "\n" line feed. So just allow "\r" to appear in the middle of a line. --- lib/PublicInbox/SolverGit.pm | 2 +- xt/solver.t | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index eab8459b..5ac27988 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -155,7 +155,7 @@ sub extract_diff ($$) { # the meat of the diff, including "^\\No newline ..." # We also allow for totally blank lines w/o leading spaces, # because git-apply(1) handles that case, too - (?:^(?:[\@\+\x20\-\\][^\r\n]*|)$LF)+ + (?:^(?:[\@\+\x20\-\\][^\n]*|)$LF)+ )!smx or return; my $di = { diff --git a/xt/solver.t b/xt/solver.t index e9f24e7f..4ff57fe7 100644 --- a/xt/solver.t +++ b/xt/solver.t @@ -20,6 +20,8 @@ my $app = sub { # TODO: convert these to self-contained test cases my $todo = { 'git' => [ + '9e9048b02bd04d287461543d85db0bb715b89f8c' + .'/s/?b=t%2Ft3420%2Fremove-ids.sed', 'eebf7a8/s/?b=t%2Ftest-lib.sh', 'eb580ca513/s/?b=remote-odb.c', '776fa90f7f/s/?b=contrib/git-jump/git-jump',