Repository navigation
[6034] 修复 root 环境下只读文件权限判断导致 Debian 13 CI 失败 - #4795
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题原因
Debian 13 CI 在容器中以
root身份运行,has_permission(name, "w")底层调用 POSIXaccess(path, W_OK),对0444只读文件仍返回可写,导致unified_readonly_test中set_file_read_only(true)后get_file_read_only()返回false。修复内容
qt_is_file_readonly(url),通过QFile::permissions()检查文件是否已清除所有写权限位;is_file_read_only(url),结合!has_permission(u, "w")与qt_is_file_readonly(u)判断文件只读状态;set_file_read_only、rename_buffer、set_buffer_tree、buffer_import中统一使用is_file_read_only。测试
xmake b unified_readonly_test && xmake r unified_readonly_test:通过(3 passed, 0 failed)。