Skip to content

Commit 18931e4

Browse files
GomesGoncalomattsu2020
authored andcommitted
rm: don't treat symlinks as write-protected
GNU rm does not check for write-protection on symbolic links; it instead prompts to "remove symbolic link" regardless of the link's permissions or its target's status. This change: - Ensures `prompt_file` checks for symlinks specifically using `symlink_metadata`, avoiding the incorrect "write-protected" prompt. - Refactors permission checks into `is_writable_metadata` to allow using the already-fetched metadata, which also optimizes performance by reducing redundant `stat` calls. - Updates `prompt_file_permission_readonly` to operate on metadata directly.
1 parent e38de0f commit 18931e4

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

tests/by-util/test_rm.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,6 @@ fn no_preserve_root_may_not_be_abbreviated() {
12361236

12371237
assert!(at.file_exists(file));
12381238
}
1239-
12401239
#[cfg(unix)]
12411240
#[test]
12421241
fn test_symlink_to_readonly_no_prompt() {

0 commit comments

Comments
 (0)