RESOLVED FIXED 48196
Fix Perl uninitialized warnings in VCSUtils::svnStatus() and VCSUtils::removeEOL().
https://bugs.webkit.org/show_bug.cgi?id=48196
Summary Fix Perl uninitialized warnings in VCSUtils::svnStatus() and VCSUtils::remove...
Daniel Bates
Reported 2010-10-23 16:17:03 PDT
VCSUtils::svnStatus() concatenate the output of svn status with new line character. svn status may return no ouput (say for a file that has not been added, deleted, or modified). Currently, VCSUtils::svnStatus() assumes svn status always returns output. Instead, we should check that svn status returns some output before trying to concatenate it with the new line character. Also, VCSUtils::removeEOL() should return if its argument is uninitialized.
Attachments
Patch (1.74 KB, patch)
2010-10-23 16:26 PDT, Daniel Bates
no flags
Patch with unit test (4.53 KB, patch)
2010-10-23 21:57 PDT, Daniel Bates
no flags
Patch with unit test (4.53 KB, patch)
2010-10-23 22:02 PDT, Daniel Bates
no flags
Daniel Bates
Comment 1 2010-10-23 16:26:44 PDT
For completeness, I came across this issues when performing the following within the WebKit directory: 1. Download the patch for bug 6751 <https://bug-6751-attachments.webkit.org/attachment.cgi?id=71377> to ~/Desktop as Bug6751_2.patch 2. WebKitTools/Scripts/svn-apply ~/Desktop/Bug6751_2.patch. Then the output of svn-apply will contain: ... patching file LayoutTests/fast/frames/resources/frame-element-name-left.html patching file LayoutTests/fast/frames/resources/frame-element-name-right.html Use of uninitialized value $line in substitution (s///) at /Users/dbates/Desktop/WebKit/WebKitTools/Scripts/VCSUtils.pm line 417. Use of uninitialized value in concatenation (.) or string at /Users/dbates/Desktop/WebKit/WebKitTools/Scripts/VCSUtils.pm line 447. Notice the uninitialized value warnings.
Daniel Bates
Comment 2 2010-10-23 16:26:59 PDT
David Kilzer (:ddkilzer)
Comment 3 2010-10-23 21:41:23 PDT
Comment on attachment 71660 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=71660&action=review Is it possible to write a test for this? Maybe verify that removeEOL(undef) returns ""? > WebKitTools/Scripts/VCSUtils.pm:416 > + return unless $line; Why not do this? return "" unless $line; > WebKitTools/Scripts/VCSUtils.pm:447 > + $svnStatus = (removeEOL(<SVN>) || "") . "\n"; Then you don't have to do anything special here.
Daniel Bates
Comment 4 2010-10-23 21:46:24 PDT
(In reply to comment #3) > (From update of attachment 71660 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=71660&action=review > > Is it possible to write a test for this? Maybe verify that removeEOL(undef) returns ""? Yes, we can write a test for this. We would need to export the function removeEOL. > > > WebKitTools/Scripts/VCSUtils.pm:416 > > + return unless $line; > > Why not do this? > > return "" unless $line; Will change.
Daniel Bates
Comment 5 2010-10-23 21:57:47 PDT
Created attachment 71668 [details] Patch with unit test Updated patch based on David Kilzer's comments. Added unit test.
Daniel Bates
Comment 6 2010-10-23 22:02:28 PDT
Created attachment 71669 [details] Patch with unit test Fix copyright in unit test file removeEOL.pl.
David Kilzer (:ddkilzer)
Comment 7 2010-10-24 06:17:57 PDT
Comment on attachment 71669 [details] Patch with unit test Thanks Dan! r=me
Daniel Bates
Comment 8 2010-10-24 09:54:18 PDT
Comment on attachment 71669 [details] Patch with unit test Clearing flags on attachment: 71669 Committed r70415: <http://trac.webkit.org/changeset/70415>
Daniel Bates
Comment 9 2010-10-24 09:54:24 PDT
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.