Commit fc17efe
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 f4ed162 commit fc17efe
2 files changed
Lines changed: 32 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | 552 | | |
563 | | - | |
564 | | - | |
| 553 | + | |
565 | 554 | | |
566 | 555 | | |
567 | 556 | | |
| |||
799 | 788 | | |
800 | 789 | | |
801 | 790 | | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | 791 | | |
811 | | - | |
| 792 | + | |
812 | 793 | | |
813 | 794 | | |
814 | 795 | | |
815 | | - | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
816 | 802 | | |
817 | 803 | | |
818 | 804 | | |
819 | 805 | | |
820 | 806 | | |
821 | 807 | | |
822 | | - | |
| 808 | + | |
| 809 | + | |
823 | 810 | | |
824 | 811 | | |
825 | | - | |
| 812 | + | |
826 | 813 | | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
831 | 818 | | |
832 | 819 | | |
833 | 820 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1217 | 1217 | | |
1218 | 1218 | | |
1219 | 1219 | | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
0 commit comments