inconsistent behaviour between GNU and uutils `mv` for symlink-<slash> as source
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
Component
mv
Inconsistent Behaviour
To reproduce
mkdir foo-dir
ln -s foo-dir foo-link
gmv foo-link/ foo-dir # gmv cuz I'm on MacOS
uu-mv foo-link/ foo-dir
gmv returns gmv: cannot move 'link-to-dir/' to 'testdir/link-to-dir': Not a directory
While uu-mv returns uu-mv: cannot move 'link-to-dir/' to a subdirectory of itself, 'testdir/link-to-dir'
This was raised when I was experimenting to resolve #5451.
Cause and fix
src/uu/mv/src/mv.rs lacks in a checking mechanism (path_ends_with_terminator + is_symlink) for source. It goes all the way into checking if source and target are the same before throwing the error.
Could insert this mechanism at line 397.
If this issue is valid, can I claim and work on it?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction commands using gmv and uu-mv, then inspect src/uu/mv/src/mv.rs around line 397 and the mentioned path_ends_with_terminator and is_symlink checks. Done means uu-mv reports the same not-a-directory behavior as GNU mv for a symlink with a trailing slash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100