Repository navigation
Conversation
| if (miss_mode == MissingHandling::Existing | ||
| || (miss_mode == MissingHandling::Normal && !parts.is_empty())) => | ||
| || (miss_mode == MissingHandling::Normal | ||
| && (!parts.is_empty() || e.kind() != ErrorKind::NotFound))) => |
There was a problem hiding this comment.
this changes realpath too, could you please add the same test in tests/by-util/test_realpath.rs?
There was a problem hiding this comment.
Added the matching realpath regression test. It fails without the fix and passes with it. All 62 readlink/realpath tests pass. Squashed and pushed—thanks!
beec309 to
dccf727
Compare
| if (miss_mode == MissingHandling::Existing | ||
| || (miss_mode == MissingHandling::Normal && !parts.is_empty())) => | ||
| || (miss_mode == MissingHandling::Normal | ||
| && (!parts.is_empty() || e.kind() != ErrorKind::NotFound))) => |
There was a problem hiding this comment.
this is also used by mv (assert_not_same_file uses ?), did you check the error message for mv a dir_without_x/sub/b doesn't change?
There was a problem hiding this comment.
Good catch—the shared change did alter mv’s diagnostic. I’ve restored the previous error message and added a regression test for your example that also verifies both files remain unchanged. All 211 mv, readlink, and realpath tests pass.
dccf727 to
4cdebf0
Compare
Merging this PR will not alter performance
|
4cdebf0 to
72d9098
Compare
| || (miss_mode == MissingHandling::Normal | ||
| && (!parts.is_empty() || e.kind() != ErrorKind::NotFound))) => |
There was a problem hiding this comment.
This condition is complex enough to justify an explanation comment IMO
There was a problem hiding this comment.
Added a comment explaining the three modes and why Normal allows only a missing final component. Regression tests pass; squashed and pushed.
72d9098 to
3bbb97f
Compare
3bbb97f to
168ed8d
Compare
Preserve permission errors when canonicalizing the final path component. Add a regression covering inaccessible paths and continued processing of later operands.
Fixes the remaining canonicalization case after #14799.
Closes #6688.