Bug 167903 - File index appended to previous file in svn-create-patch with SVN 1.9
Summary: File index appended to previous file in svn-create-patch with SVN 1.9
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jonathan Bedard
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-02-06 13:26 PST by Sam Weinig
Modified: 2017-02-07 13:04 PST (History)
6 users (show)

See Also:


Attachments
Patch (1.17 KB, patch)
2017-02-07 11:08 PST, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (3.25 KB, patch)
2017-02-07 11:43 PST, Jonathan Bedard
dbates: review-
Details | Formatted Diff | Diff
Patch and unit tests (3.12 KB, patch)
2017-02-07 12:19 PST, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch and unit tests (3.11 KB, patch)
2017-02-07 12:20 PST, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2017-02-06 13:26:23 PST
The EWS bot does not seem to be able to apply the patch in 167806. The patch posted using webkit-patch post from an up-to-date tree.
Comment 1 Radar WebKit Bug Importer 2017-02-06 16:37:16 PST
<rdar://problem/30387395>
Comment 2 Jonathan Bedard 2017-02-07 08:07:36 PST

*** This bug has been marked as a duplicate of bug 167906 ***
Comment 3 Alexey Proskuryakov 2017-02-07 09:04:42 PST
Let's track the issue in this older bug.
Comment 4 Alexey Proskuryakov 2017-02-07 09:05:01 PST
*** Bug 167906 has been marked as a duplicate of this bug. ***
Comment 5 Jonathan Bedard 2017-02-07 11:06:28 PST
Actually, this is an issue I've seen locally, it's just now that I've noticed what the root cause is.

SVN 1.9 doesn't always emit newlines at the end of patches, and we don't explicitly add them.  Sometimes the index line of the next file gets appended to the last line of the previous file.
Comment 6 Jonathan Bedard 2017-02-07 11:08:37 PST
Created attachment 300822 [details]
Patch
Comment 7 Jonathan Bedard 2017-02-07 11:17:32 PST
If you search for 'Index: Source/WebCore/bindings/js/JSDOMConvertBase.h' in https://bug-167806-attachments.webkit.org/attachment.cgi?id=300583, you will see an example of a file index being appended to the previous change.
Comment 8 Jonathan Bedard 2017-02-07 11:43:47 PST
Created attachment 300829 [details]
Patch
Comment 9 Daniel Bates 2017-02-07 11:53:39 PST
Comment on attachment 300829 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300829&action=review

> Tools/Scripts/svn-create-patch:245
> +    $patch eq "" or (substr $patch, -1) eq "\n" or die;

We need to make this work for arbitrary end-of-line characters. I would also write this in the form:

die if ($patch && $patch =~ /\r?$/);

(The regular expression used may not be correct. Please check.)
Comment 10 Daniel Bates 2017-02-07 11:56:46 PST
Comment on attachment 300829 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300829&action=review

> Tools/Scripts/VCSUtils.pm:1782
> +    return join($lineEnding, @lines) . $lineEnding;

Is it OK to use $lineEnding here?fixChangeLogPatch() has similar logic and emits a new-line character because "patch(1) expects an extra trailing newline".
Comment 11 Daniel Bates 2017-02-07 12:06:00 PST
(In reply to comment #9)
> Comment on attachment 300829 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=300829&action=review
> 
> > Tools/Scripts/svn-create-patch:245
> > +    $patch eq "" or (substr $patch, -1) eq "\n" or die;
> 
> We need to make this work for arbitrary end-of-line characters. I would also
> write this in the form:
> 
> die if ($patch && $patch =~ /\r?$/);
> 

Assuming the comment in fixChangeLogPatch() is true [1], we should write this as:

die if ($patch && substr($patch, -1) ne "\n");

[1] <https://trac.webkit.org/browser/trunk/Tools/Scripts/VCSUtils.pm?rev=211828#L1935>
Comment 12 Daniel Bates 2017-02-07 12:09:58 PST
Comment on attachment 300829 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300829&action=review

> Tools/Scripts/webkitperl/VCSUtils_unittest/fixSVNPatchForAdditionWithHistory.pl:47
> +

Actually we shouldn't add this line here. Instead we should remove the chomp() from <https://trac.webkit.org/browser/trunk/Tools/Scripts/webkitperl/VCSUtils_unittest/fixSVNPatchForAdditionWithHistory.pl?rev=211828#L285>.
Comment 13 Daniel Bates 2017-02-07 12:19:31 PST
Created attachment 300832 [details]
Patch and unit tests
Comment 14 Daniel Bates 2017-02-07 12:20:50 PST
Created attachment 300833 [details]
Patch and unit tests
Comment 15 WebKit Commit Bot 2017-02-07 13:04:15 PST
Comment on attachment 300833 [details]
Patch and unit tests

Clearing flags on attachment: 300833

Committed r211833: <http://trac.webkit.org/changeset/211833>
Comment 16 WebKit Commit Bot 2017-02-07 13:04:19 PST
All reviewed patches have been landed.  Closing bug.