Skip to content

mv should error when attempting to move folders into itself #13082

Closed
@abhishekmukherg

Description

Describe the bug

Discord Discussion

mv will happily execute the following, and not return any error of it being unexpected or nonsensical. This can end up with confusing results where the folder just disappears.

How to reproduce

mkdir a
mv a a/a

Expected behavior

Something similar to zsh:

mkdir a
mv a a/a
mv: rename a to a/a: Invalid argument

Screenshots

No response

Configuration

key value
version 0.93.0
major 0
minor 93
patch 0
branch
commit_hash
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.77.2 (25ef9e3d8 2024-04-09) (built from a source tarball)
cargo_version cargo 1.77.1
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, system-clipboard, trash, which
installed_plugins polars

Additional context

No response

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't workingcoreutils-uutilsChanges relating to coreutils/uutilsfile-systemRelated to commands and core nushell behavior around the file systemsilent-failCases where nothing or something bad happens and an error would be helpful and expectedupstreamproblem with upstream dependency

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions