You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#8910
Match POSIX/GNU behavior where dirname("/home/dos/.") returns
"/home/dos" instead of "/home". This aligns with the basename fix
from #8373 (c5268a8).
The issue occurs because Rust's Path::parent() normalizes paths,
treating "/home/dos/." the same as "/home/dos/", both returning
"/home" as the parent. This breaks tools like homeshick that rely
on correct dirname behavior for symlink generation.
Solution:
- Detect paths ending in "/." using byte-level checking
- Strip the "/." suffix manually before path operations
- Handle edge case: "/." -> "/"
- Preserve non-UTF-8 path handling with platform-specific code
- Add comprehensive tests covering edge cases
Tests added:
- Basic "/." handling (5 test cases)
- Flag interaction with -z/--zero
- Multiple paths with mixed "/." suffixes
- Edge cases: double slashes, dots in middle
- Unicode/emoji paths
- Non-UTF-8 paths (Unix only)
- Backward compatibility verification (7 test cases)
0 commit comments