[Webkit-unassigned] [Bug 115281] WebKit tools cannot apply patches for filenames containing spaces

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 26 16:57:28 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=115281





--- Comment #7 from Simon Cooper <scooper at apple.com>  2013-04-26 16:55:48 PST ---
There is a faulty regex:  $gitDiffStartRegEx. 

It is not sufficient to parse arguments containing spaces.  The logic in parseGitDiffHeader() doesn’t help, because it assumes the regex actually can parse all filenames.  That isn’t how it is done for SVN.

There are perfectly good and easily parseable filenames on the line following the “diff” line.

However, the following diff will parse my patch (although there may be issues with other tools) — I just debugged this to the point where it can parse the diffs.

diff --git a/Tools/Scripts/VCSUtils.pm b/Tools/Scripts/VCSUtils.pm
index cf87db3..fb6380a 100644
--- a/Tools/Scripts/VCSUtils.pm
+++ b/Tools/Scripts/VCSUtils.pm
@@ -107,7 +107,7 @@ my $svnVersion;
 # Project time zone for Cupertino, CA, US
 my $changeLogTimeZone = "PST8PDT";

-my $gitDiffStartRegEx = qr#^diff --git (\w/)?(.+) (\w/)?([^\r\n]+)#;
+my $gitDiffStartRegEx = qr#^diff --git (\w/)(.+) (\w/)([^\r\n]+?)$#;
 my $svnDiffStartRegEx = qr#^Index: ([^\r\n]+)#;
 my $svnPropertiesStartRegEx = qr#^Property changes on: ([^\r\n]+)#; # $1 is normally the same as the index path.
 my $svnPropertyStartRegEx = qr#^(Modified|Name|Added|Deleted): ([^\r\n]+)#; # $2 is the name of the property.


The fix works by making sure the starting a/ or b/ are not optional, the 2nd regex is *not* greedy and the whole regex needs to be terminally anchored (to force the consumption of the whole string).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list