Python项目中跨操作系统可移植性问题的实证分析
An Empirical Analysis of Cross-OS Portability Issues in Python Projects
- Federal University of Pernambuco(伯南布哥联邦大学)
- North Carolina State University(北卡罗来纳州立大学)
机构由 AI 辅助整理,请以论文原文为准。
AI总结:
本研究首次大规模实证分析Python跨操作系统可移植性问题,通过测试重执行和GitHub问题分析,提出分类体系并验证LLM修复能力,为开发者提供实践指导。
AI中文摘要:
虽然Python被设计为一种跨平台语言,但真实世界的应用在不同操作系统上部署时仍会遇到可移植性故障。我们首次对Python中的跨操作系统可移植性问题进行了大规模实证研究,使用两种互补方法分析了2,042个开源仓库:系统性的跨操作系统测试重执行和GitHub问题的人工分析。我们对500个项目的跨平台测试显示,11.2%的项目表现出依赖于操作系统的测试失败。通过对240个GitHub问题的系统分析,我们确认了102个真实的可移植性问题,涉及另外95个项目。我们开发了一个全面的分类体系,识别出7个主要失败类别——其中文件/目录操作、进程管理和库依赖最为普遍——以及24个不同的子类别、15种诊断特征和4种系统性修复模式。我们的评估显示,现有的静态分析工具对可移植性检测提供的支持极少,而大型语言模型在提供结构化指导时,识别问题的准确率达到40-79%,生成修复的成功率达到50-77%。通过贡献的33个拉取请求,我们展示了研究成果的实际适用性和开发者接受度(17个已合并,零个被拒绝)。这项工作为理解和解决Python中的跨操作系统可移植性问题建立了首个全面基线,为开发者、工具设计者和更广泛的研究社区提供了可操作的见解。
英文摘要:
While Python is designed as a cross-platform language, real-world applications encounter portability failures when deployed across different operating systems. We present the first large-scale empirical study of cross-OS portability issues in Python, analyzing 2,042 open-source repositories using two complementary approaches: systematic cross-OS test reexecution and manual analysis of GitHub issues. Our cross-platform testing of 500 projects reveals that 11.2% exhibit OS-dependent test failures. Through systematic analysis of 240 GitHub issues, we confirm 102 genuine portability problems spanning 95 additional projects. We develop a comprehensive taxonomy identifying 7 primary failure categories - with file/directory operations, process management, and library dependencies being most prevalent - along with 24 distinct sub-categories, 15 diagnostic signatures, and 4 systematic repair patterns. Our evaluation reveals that existing static analysis tools provide minimal support for portability detection, while large language models achieve 40-79% accuracy in identifying issues and 50-77% success in generating fixes when provided with structured guidance. Through 33 contributed pull requests, we demonstrate practical applicability and developer acceptance (17 merged, zero rejected) of our findings. This work establishes the first comprehensive baseline for understanding and addressing cross-OS portability issues in Python, providing actionable insights for developers, tool designers, and the broader research community.