Commit aad33db
committed
rm: don't treat symlinks as write-protected
Detect symlinks in prompt_file() using fs::symlink_metadata() and handle them differently:
- InteractiveMode::Always should still prompt with "remove symbolic link ...?".
- For all other interactive modes, do not follow the symlink target or use the target's permissions to decide a write-protected prompt.
Adds a unit test test_symlink_not_write_protected_prompt to verify that a symlink to a read-only file is not treated as a write-protected regular file.1 parent fd9157a commit aad33db
1 file changed
+35
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
808 | 807 | | |
809 | 808 | | |
810 | 809 | | |
| |||
819 | 818 | | |
820 | 819 | | |
821 | 820 | | |
| 821 | + | |
822 | 822 | | |
823 | 823 | | |
824 | 824 | | |
| |||
975 | 975 | | |
976 | 976 | | |
977 | 977 | | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
978 | 1008 | | |
0 commit comments