{"record":{"id":"7543e3275c88259e","repo":"uutils/coreutils","slug":"notfound","errorCode":"NotFound","errorMessage":"backing up {$target} might destroy source;  {$source} not moved","messagePattern":"backing up (.+?) might destroy source;  (.+?) not moved","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"src/uu/mv/src/mv.rs","lineNumber":381,"sourceCode":"    }\n}\n\nfn parse_paths(files: &[OsString], opts: &Options) -> Vec<PathBuf> {\n    let paths = files.iter().map(Path::new);\n\n    if opts.strip_slashes {\n        paths\n            .map(|p| p.components().as_path().to_owned())\n            .collect::<Vec<PathBuf>>()\n    } else {\n        paths.map(ToOwned::to_owned).collect::<Vec<PathBuf>>()\n    }\n}\n\nfn handle_two_paths(source: &Path, target: &Path, opts: &Options) -> UResult<()> {\n    // `mv` never follows a symlink source, so the guard must not either.\n    if backup_would_destroy_source(source, target, &opts.suffix, opts.backup, false) {\n        return Err(io::Error::new(\n            io::ErrorKind::NotFound,\n            translate!(\"mv-error-backup-might-destroy-source\", \"target\" => target.quote(), \"source\" => source.quote()),\n        )\n        .into());\n    }\n    let Ok(source_metadata) = source.symlink_metadata() else {\n        return Err(if path_ends_with_terminator(source) {\n            MvError::CannotStatNotADirectory(source.quote().to_string()).into()\n        } else {\n            MvError::NoSuchFile(source.quote().to_string()).into()\n        });\n    };\n\n    // `symlink_metadata` does not follow symlinks, so this is equivalent to\n    // `source.is_dir() && !source.is_symlink()` without the extra `stat` calls.\n    let source_is_dir = source_metadata.is_dir();\n    let target_is_dir = match target.symlink_metadata() {\n        Ok(metadata) if metadata.is_symlink() => fs::canonicalize(target).is_ok_and(|p| p.is_dir()),","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/uutils/coreutils/blob/85295bbf788bfd7a6926ba692031563504b304b7/src/uu/mv/src/mv.rs#L363-L399","documentation":"Error \"backing up {$target} might destroy source;  {$source} not moved\" thrown in uutils/coreutils.","triggerScenarios":"Occurs when mv -b would back up the destination over the source file itself, which would destroy the data being moved, so mv refuses.","commonSituations":"Moving a file onto its own backup name (e.g. `mv -b foo foo~`) or hard-link/backup collisions where target backup equals the source.","solutions":["Choose a backup path that is not inside the source file itself; verify source and backup are different files.","Use --backup with a suffix or numbered backups so the backup never overwrites the source."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"85295bbf788bfd7a6926ba692031563504b304b7","analyzedAt":"2026-08-19T21:43:27.871Z","contentChangedAt":"2026-08-19T21:43:27.871Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}