Skip to content

mv allows moving a directory into itself #13508

Closed
@jcaesar

Description

Describe the bug

The detection of cannot move X to a subdirectory of itself, X/Y is imperfect, and it is sometime still possible to execute the move, resulting in the directory disappearing.

How to reproduce

korsika in /tmp/foo
➜ mkdir foo/bar-blubb/alt 1 2 3

korsika in /tmp/foo
➜ mv * foo/bar-blubb/alt

korsika in /tmp/foo
➜ ls
╭────────────╮
│ empty list │
╰────────────╯

Expected behavior

Error message.

Configuration

key value
version 0.96.0
major 0
minor 96
patch 0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.79.0 (129f3b996 2024-06-10) (built from a source tarball)
cargo_version cargo 1.79.0
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator mimalloc
features default, sqlite, system-clipboard, trash
installed_plugins

(As obtained from github:NixOS/nixpkgs/3fcada1050e3820241590679838954bacf7d38f8#nushell.)

korsika in /tmp/foo
➜ findmnt -T .
TARGET
  SOURCE    FSTYPE OPTIONS
/ /dev/dm-0 btrfs  rw,relatime,ssd,space_cache=v2,subvolid=5,subvol=/

Additional context

This is not a duplicate of #2612, that's still sound and fixed..

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue is a duplicate of another issue and will be consolidated for easier handlingfile-systemRelated to commands and core nushell behavior around the file systemneeds-triageAn issue that hasn't had any proper lookupstreamproblem with upstream dependency

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions