一句话:提出 build fuzzing:通过变异文件、触发增量构建并对比依赖图预期,自动发现构建规则中缺失的依赖。
自动构建系统依赖开发者手工列举文件与模块间的依赖,遗漏依赖会导致增量构建错误。本文提出 build fuzzing 方法自动检测此类缺失依赖:先追踪干净构建期间的系统调用,推断出依赖图;再修改项目文件并触发增量构建,将实际发生变化的文件集合与依赖图预测的预期变化集合进行对比,不一致即表明构建规则不正确。作者对多个开源项目的构建规则进行了穷举测试,在 31 个项目中发现了导致竞态条件和错误构建的问题,并讨论了检测到的缺陷及宏语言使用中的反模式。在构建系统特性允许清晰解决方案的项目中,作者还修复了部分问题。
Automated build systems are routinely used by software engineers to minimize the number of objects that need to be recompiled after incremental changes to the source files of a project. In order to achieve efficient and correct builds, developers must provide the build tools with dependency information between the files and modules of a project, usually expressed in a macro language specific to each build tool. In order to guarantee correctness, the authors of these tools are responsible for enumerating all the files whose contents an output depends on. Unfortunately, this is a tedious process and not all dependencies are captured in practice, which leads to incorrect builds. We automatically uncover such missing dependencies through a novel method that we call build fuzzing. The correctness of build definitions is verified by modifying files in a project, triggering incremental builds and comparing the set of changed files to the set of expected changes. These sets are determined using a dependency graph inferred by tracing the system calls executed during a clean build. We evaluate our method by exhaustively testing build rules of open-source projects, uncovering issues leading to race conditions and faulty builds in 31 of them. We provide a discussion of the bugs we detect, identifying anti-patterns in the use of the macro languages. We fix some of the issues in projects where the features of build systems allow a clean solution.