RESOLVED FIXED 54928
PrettyPatch.rb doesn't handle diffs where lines matching /^--/ are missing properly
https://bugs.webkit.org/show_bug.cgi?id=54928
Summary PrettyPatch.rb doesn't handle diffs where lines matching /^--/ are missing pr...
Dirk Pranke
Reported 2011-02-21 19:47:35 PST
This bug is cloned from bug 54918 - the test that was causing the problem has been patched, but this bug will track the root cause. From bug 54918: > LayoutTests/platform/mac/fast/objc/dom-html-select-activate.html has a few statements of the > form log("-- foo") in it, which causes a text line containing two dashes at the start of the line to be > output in dumpAsText() mode. > > If the test fails in such a way that those lines aren't output (as it does on chromium-mac at the > moment), then the unified diff contains a line with "---" at the start. > > PrettyPatch.rb interprets that as the start of a new file for diffing, and gets confused when > there's no filename, and errors out. > > I think, in FileDiff.parse, it needs to be taught to understand the "@@ -1,26 +1,6 @@" line and > skip over the appropriate number of lines of input correctly, rather than just looking for a line > containing "---". > My Ruby is weak, and I am lazy, and PrettyPatch appears to have no unit tests, so I haven't actually > submitted a patch to do this. If, however, you change dom-html-select-activate to the contents > of the first attachment, you'll get the diff in the second attachment, and old-run-webkit-tests > will keel over with PrettyPatch failing.
Attachments
modified version of the test file that will fail, producing the diff file in the next attachment that will cause PrettyPatch to crash. (412 bytes, text/html)
2011-02-21 19:48 PST, Dirk Pranke
no flags
diff file that will cause PrettyPatch to crash (961 bytes, text/plain)
2011-02-21 19:48 PST, Dirk Pranke
no flags
Proposed patch (1.64 KB, patch)
2013-12-12 04:28 PST, Dániel Bátyai
no flags
Proposed patch (1.65 KB, patch)
2013-12-12 04:39 PST, Dániel Bátyai
no flags
Proposed patch (1.65 KB, patch)
2013-12-16 07:14 PST, Dániel Bátyai
no flags
Dirk Pranke
Comment 1 2011-02-21 19:48:06 PST
Created attachment 83258 [details] modified version of the test file that will fail, producing the diff file in the next attachment that will cause PrettyPatch to crash.
Dirk Pranke
Comment 2 2011-02-21 19:48:28 PST
Created attachment 83259 [details] diff file that will cause PrettyPatch to crash
Dániel Bátyai
Comment 3 2013-12-12 04:28:51 PST
Created attachment 219074 [details] Proposed patch
Dániel Bátyai
Comment 4 2013-12-12 04:39:03 PST
Created attachment 219075 [details] Proposed patch
Adam Roben (:aroben)
Comment 5 2013-12-12 08:02:29 PST
Comment on attachment 219075 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=219075&action=review > Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:665 > + line_array = string.each_line.to_a I believe it's more idiomatic to use string.lines.to_a here instead of string.each_line.to_a
Dániel Bátyai
Comment 6 2013-12-16 07:14:01 PST
Created attachment 219316 [details] Proposed patch
Adam Roben (:aroben)
Comment 7 2013-12-16 08:13:12 PST
Comment on attachment 219316 [details] Proposed patch r=me
WebKit Commit Bot
Comment 8 2013-12-16 08:41:59 PST
Comment on attachment 219316 [details] Proposed patch Clearing flags on attachment: 219316 Committed r160642: <http://trac.webkit.org/changeset/160642>
WebKit Commit Bot
Comment 9 2013-12-16 08:42:01 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.