• DocumentCode
    880155
  • Title

    CP-Miner: finding copy-paste and related bugs in large-scale software code

  • Author

    Li, Zhenmin ; Lu, Shan ; Myagmar, Suvda ; Zhou, Yuanyuan

  • Author_Institution
    Dept. of Comput. Sci., Illinois Univ., Urbana, IL, USA
  • Volume
    32
  • Issue
    3
  • fYear
    2006
  • fDate
    3/1/2006 12:00:00 AM
  • Firstpage
    176
  • Lastpage
    192
  • Abstract
    Recent studies have shown that large software suites contain significant amounts of replicated code. It is assumed that some of this replication is due to copy-and-paste activity and that a significant proportion of bugs in operating systems are due to copy-paste errors. Existing static code analyzers are either not scalable to large software suites or do not perform robustly where replicated code is modified with insertions and deletions. Furthermore, the existing tools do not detect copy-paste related bugs. In this paper, we propose a tool, CP-Miner, that uses data mining techniques to efficiently identify copy-pasted code in large software suites and detects copy-paste bugs. Specifically, it takes less than 20 minutes for CP-Miner to identify 190,000 copy-pasted segments in Linux and 150,000 in FreeBSD. Moreover, CP-Miner has detected many new bugs in popular operating systems, 49 in Linux and 31 in FreeBSD, most of which have since been confirmed by the corresponding developers and have been rectified in the following releases. In addition, we have found some interesting characteristics of copy-paste in operating system code. Specifically, we analyze the distribution of copy-pasted code by size (number lines of code), granularity (basic blocks and functions), and modification within copy-pasted code. We also analyze copy-paste across different modules and various software versions.
  • Keywords
    data mining; operating systems (computers); program debugging; program diagnostics; software maintenance; software reusability; software tools; CP-Miner tool; FreeBSD; Linux; code duplication; code reuse; copy-paste bugs; data mining technique; debugging aids; large-scale software code; operating system code bugs; replicated code; static code analyzer; Cloning; Computer bugs; Data mining; Kernel; Large-scale systems; Linux; Operating systems; Performance analysis; Programming profession; Software performance; Software analysis; code duplication; code reuse; data mining.; debugging aids;
  • fLanguage
    English
  • Journal_Title
    Software Engineering, IEEE Transactions on
  • Publisher
    ieee
  • ISSN
    0098-5589
  • Type

    jour

  • DOI
    10.1109/TSE.2006.28
  • Filename
    1610609