1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

ln: don't show error when overwriting a link with -sfn (#7449)

* ln: fix #6350

* test(ln): test_symlink_no_deref_dir success has no stderr
This commit is contained in:
Dorian Péron 2025-05-30 16:29:43 +02:00 committed by GitHub
parent 94132060b6
commit 1baedc417b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -301,6 +301,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings)
show_error!("Could not update {}: {e}", target_dir.quote());
};
}
#[cfg(windows)]
if target_dir.is_dir() {
// Not sure why but on Windows, the symlink can be
// considered as a dir

View file

@ -549,7 +549,11 @@ fn test_symlink_no_deref_dir() {
scene.ucmd().args(&["-sn", dir1, link]).fails();
// Try with the no-deref
scene.ucmd().args(&["-sfn", dir1, link]).succeeds();
scene
.ucmd()
.args(&["-sfn", dir1, link])
.succeeds()
.no_stderr();
assert!(at.dir_exists(dir1));
assert!(at.dir_exists(dir2));
assert!(at.is_symlink(link));