rm --preserve-root should work on symlink too#9706
Conversation
a94c698 to
77ab2ed
Compare
|
GNU testsuite comparison: |
src/uu/rm/src/rm.rs
Outdated
| // Use symlink_metadata to get the actual target's dev/ino | ||
| // after following symlinks (we need to follow the symlink to see | ||
| // where it points) | ||
| if let Ok(metadata) = fs::metadata(path) { |
There was a problem hiding this comment.
I think the MacOS tests are failing here because its unable to get the metadata even though its root. Adding a canonicalize to here so that in the MacOS case where the tests are failing, even though:
// First check the simple path-based case (e.g., "/")
let path_looks_like_root = path.has_root() && path.parent().is_none();
This exists, if you can't get the metadata it will still fail if the canonicalize returns a "/" after this step
09459c4 to
82dd553
Compare
|
GNU testsuite comparison: |
78e1996 to
7474e2a
Compare
|
GNU testsuite comparison: |
1 similar comment
|
GNU testsuite comparison: |
7474e2a to
a8c2352
Compare
|
GNU testsuite comparison: |
a8c2352 to
5002857
Compare
|
GNU testsuite comparison: |
src/uu/rm/src/rm.rs
Outdated
| } else { | ||
| // Path resolves to root but isn't literally "/" (e.g., symlink to /) | ||
| show_error!( | ||
| "it is dangerous to operate recursively on '{}' (same as '/')", |
There was a problem hiding this comment.
I see the translate file was added for this, I think it was just removed accidentally
5002857 to
af4c25d
Compare
|
This is not the type of PR that is good to review early in the morning. I was locally validating that the behavior was fixed and started nuking my dev box. |
i am so sorry :( |
Closes: #9705