Automatic Identification of bug inducing changes

34
Automatic Identification of Bug- Introducing Changes Kim, Zimmermann, Pan, Whitehead Presented By**: Arnamoy Bhattacharyya University of Alberta **some slides are taken from the presentation of Nicolas Bettenburg

description

Presented in CMPUT664 , Wi '12 in UofAlberta

Transcript of Automatic Identification of bug inducing changes

Page 1: Automatic Identification of  bug inducing changes

Automatic Identification of Bug-

Introducing Changes

Kim, Zimmermann, Pan, Whitehead

Presented By**:

Arnamoy Bhattacharyya

University of Alberta

**some slides are taken from the presentation of Nicolas Bettenburg

Page 2: Automatic Identification of  bug inducing changes
Page 3: Automatic Identification of  bug inducing changes

Control Development

Multi User Access

Change History

Capture Problems

Multi User Access

Error History

Page 4: Automatic Identification of  bug inducing changes
Page 5: Automatic Identification of  bug inducing changes

Bug Report #5612 reports an error

Error fixed in version 0.13

Commit Message in 0.13 : "Fixed Bug #5612"

Page 6: Automatic Identification of  bug inducing changes

Finding changes that have repaired a bug

searching for keywords such as "Fixed" or "Bug"

searching for references to bug reports like “#42233”

Page 7: Automatic Identification of  bug inducing changes

when?

who?

Page 8: Automatic Identification of  bug inducing changes
Page 9: Automatic Identification of  bug inducing changes
Page 10: Automatic Identification of  bug inducing changes

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5: }

6: }

1: public void foo() {

2: // print report

3: if (report == null)

4: {

5: println(report);

6: }

7: }

1: public void foo() {

2: // print out report

3: if (report != null)

4: {

5: println(report);

6: }

7. }

Revision 0.11 Revision 0.12 Revision 0.13

Page 11: Automatic Identification of  bug inducing changes

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5:

6: }

1: public void foo() {

2: // print report

3: if (report == null)

4: {

5: println(report);

6: }

7: }

1: public void foo() {

2: // print out report

3: if (report != null)

4: {

5: println(report);

6: }

Revision 0.11 Revision 0.12 Revision 0.13

Running diff tool between 0.12 and 0.13

Page 12: Automatic Identification of  bug inducing changes

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5: }

6: }

0.12 sam 1: public void foo() {

0.11 kim 2: // print report

0.12 sam 3: if (report == null)

0.12 sam 4: {

0.11 kim 5: println(report);

0.11 kim 6: }

0.11 kim 7: }

public void foo() {

// print out report

3: if (report != null)

4: {

5: println(report);

6: }

7: }

Revision 0.11 Revision 0.12 Revision 0.13

$ cvs annotate –r 0.12 Foo.java

Page 13: Automatic Identification of  bug inducing changes

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5: }

6: }

0.12 sam 1: public void foo() {

0.11 kim 2: // print report

0.12 sam 3: if (report == null)

0.12 sam 4: {

0.11 kim 5: println(report);

0.11 kim 6: }

0.11 kim 7: }

public void foo() {

// print out report

3: if (report != null)

4: {

5: println(report);

6: }

7: }

Revision 0.11 Revision 0.12 Revision 0.13

Not

Necessary

Not

Necessary

Necessary

but WRONG

Page 14: Automatic Identification of  bug inducing changes
Page 15: Automatic Identification of  bug inducing changes

Use Annotation Graphs

Page 16: Automatic Identification of  bug inducing changes

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5:}

6: }

1: public void foo() {

2: // print report

3: if (report == null)

4: {

5: println(report);

6: }

7: }

1: public void foo() {

2: // print out report

3: if (report != null)

4: {

5: println(report);

6: }

7. }

Revision 0.11 Revision 0.12 Revision 0.13

Page 17: Automatic Identification of  bug inducing changes

1: public void bar() {

2: // print report

3: if (report == null) {

4: println(report);

5:

6: }

1: public void foo() {

2: // print report

3: if (report == null)

4: {

5: println(report);

6: -----

7: }

1: public void foo() {

2: // print out report

3: if (report != null)

4: {

5: println(report);

6: }

Revision 0.11 Revision 0.12 Revision 0.13

Detect

function name

changesFind Bug Inducing

Change

Page 18: Automatic Identification of  bug inducing changes
Page 19: Automatic Identification of  bug inducing changes

False Positive - Indicated as Bug Inducing Change but actually not

False Negative- NOT Indicated as Bug Inducing Change but

actually is one

4.1. Using Annotation Graph

Page 20: Automatic Identification of  bug inducing changes

4.2. Non Behavior Changes

1. Comments2. Changes to source code format

3. Addition/removal of blank lines

1: public void bar() {

2: if (report == null) {

3: println(report);

4: }

1: public void bar() {

2: // print report

3: if (report == null)

4: {

5: println(report);

6:

7: }

����Addition of comment

� Change of Source code format

� Addition of Blank Lines

Page 21: Automatic Identification of  bug inducing changes

Ignoring Blank Lines and Comments

removes 14%~20% of false positives

Page 22: Automatic Identification of  bug inducing changes

removes 18%~25% of false positives and 13%~14% of false

negatives.

Ignoring Source Code Format Changes

Page 23: Automatic Identification of  bug inducing changes

4.4. Remove Fix Revision Outliers

Page 24: Automatic Identification of  bug inducing changes

most of the changes are method name and parameter name changes

ignoring outlier revisions removes 7%~16% of false positives

Page 25: Automatic Identification of  bug inducing changes

possible that we are ignoring changes are real bug-fixes

Page 26: Automatic Identification of  bug inducing changes

4.5. Manual Fix Hunk Verification

how many bug-fix hunks are true bug-fixes???

Page 27: Automatic Identification of  bug inducing changes
Page 28: Automatic Identification of  bug inducing changes

Not perfect BUT Close Enough!!

Page 29: Automatic Identification of  bug inducing changes
Page 30: Automatic Identification of  bug inducing changes
Page 31: Automatic Identification of  bug inducing changes
Page 32: Automatic Identification of  bug inducing changes

Train Data

Page 33: Automatic Identification of  bug inducing changes

Help HATARI

Page 34: Automatic Identification of  bug inducing changes