Bug 145082 - prepare-ChangeLog reports function above deleted function as deleted; uninitialized value warning when staged non-empty file for commit
Summary: prepare-ChangeLog reports function above deleted function as deleted; uniniti...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-15 17:13 PDT by Daniel Bates
Modified: 2015-05-18 16:56 PDT (History)
4 users (show)

See Also:


Attachments
Patch and unit tests (13.42 KB, patch)
2015-05-15 17:21 PDT, Daniel Bates
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2015-05-15 17:13:36 PDT
Perl warns of the use of an uninitialized variable in prepare-ChangeLog when the working copy has a non-empty new file staged for commit:

Use of uninitialized value $first_line in pattern match (m//) at Tools/Scripts/prepare-ChangeLog line 644.

Without loss of generality, you can reproduce this issue by running the following terminal commands inside the top-level directory of a Git checkout of the WebKit repository:

$ echo 'A' > A.txt
$ git add A.txt 
$ Tools/Scripts/prepare-ChangeLog

Then you will see output of the form:

  Running status to find changed, added, or removed files.
  Reviewing diff to determine which lines changed.
  Extracting affected function names from source files.
fatal: Path 'A.txt' exists on disk, but not in 'HEAD'.
Use of uninitialized value $first_line in pattern match (m//) at Tools/Scripts/prepare-ChangeLog line 644.
  Change author: Daniel Bates <dabates@apple.com>.
  Editing the ./ChangeLog file.
-- Please remember to include a detailed description in your ChangeLog entry. --
-- See <http://webkit.org/coding/contributing.html> for more info --
Comment 1 Daniel Bates 2015-05-15 17:16:11 PDT
The logic for parsing a chunk range line of a unified diff is incorrect in extractLineRange{Before, After}Change(). In addition to causes this bug it also causes prepare-ChangeLog to always emit the name of the function f_0 above a deleted function regardless of whether f_0 changed.
Comment 2 Daniel Bates 2015-05-15 17:21:50 PDT
Created attachment 253243 [details]
Patch and unit tests
Comment 3 Daniel Bates 2015-05-15 17:24:12 PDT
Comment on attachment 253243 [details]
Patch and unit tests

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

> Tools/Scripts/webkitperl/prepare-ChangeLog_unittest/extractLineRangeBeforeAndAfterChange.pl:29
> +use VCSUtils;

Will remove this before landing.
Comment 4 Daniel Bates 2015-05-18 16:56:32 PDT
Committed r184521: <http://trac.webkit.org/changeset/184521>