An Empirical Study on Regular Expression Bugs

An Empirical Study on Regular Expression Bugs
复制标题

DOI:
10.1145/3379597.3387464
复制
发表时间:
2020-05
期刊:
2020 IEEE/ACM 17th International Conference on Mining Software Repositories (MSR)
影响因子:
--
通讯作者:
Peipei Wang;Chris Brown;Jamie A. Jennings;Kathryn T. Stolee
Peipei Wang;Chris Brown;Jamie A. Jennings;Kathryn T. Stolee
中科院分区:
其他
文献类型:
--
作者:
Peipei Wang;Chris Brown;Jamie A. Jennings;Kathryn T. Stolee

文献摘要

被引文献

相似文献

了解正则表达(REGEX)问题的性质对于解决开发人员在正则表达使用方面面临的实际问题很重要。有关各种类型的正则表达问题的性质和频率的知识,例如与性能,API滥用和代码气味有关的知识,可以指导测试,为文档作者提供信息,并激励重构工作。但是,除了重做(正则表达拒绝服务)之外,几乎不知道正则表达问题在多大程度上影响软件开发以及如何在实践中解决这些问题。本文对Apache,Mozilla,Facebook和Google Github存储库的350个合并正则相关的拉力请求进行了全面的实证研究。通过对这些错误的根本原因和表现形式进行分类,我们表明正则表达行为是正则表达错误的主要根本原因(165/356,46.3%)。其余的根本原因是API使用不正确(9.3%)和其他需要修复中正则表达式更改(29.5%)的代码问题。通过研究与REGEX相关的拉力请求的代码更改,我们观察到固定正则表达式错误是无关紧要的,因为与一般拉动请求相比,它需要更多的时间和更多的代码来修复它们。这项研究的结果有助于更广泛地了解开发人员使用正则表达式时所面临的实际问题。
Understanding the nature of regular expression (regex) issues is important to tackle practical issues developers face in regular expression usage. Knowledge about the nature and frequency of various types of regular expression issues, such as those related to performance, API misuse, and code smells, can guide testing, inform documentation writers, and motivate refactoring efforts. However, beyond ReDoS (Regular expression Denial of Service), little is known about to what extent regular expression issues affect software development and how these issues are addressed in practice. This paper presents a comprehensive empirical study of 350 merged regex-related pull requests from Apache, Mozilla, Facebook, and Google GitHub repositories. Through classifying the root causes and manifestations of those bugs, we show that incorrect regular expression behavior is the dominant root cause of regular expression bugs (165/356, 46.3%). The remaining root causes are incorrect API usage (9.3%) and other code issues that require regular expression changes in the fix (29.5%). By studying the code changes of regex-related pull requests, we observe that fixing regular expression bugs is nontrivial as it takes more time and more lines of code to fix them compared to the general pull requests. The results of this study contribute to a broader understanding of the practical problems faced by developers when using regular expressions.