From 837640bc0235533f498aace9fc5c9541638ad88f Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 23 Dec 2023 11:53:25 +0100 Subject: [PATCH 1/9] cp: manages the 'seen' file list before copying Should help with tests/mv/childproof.sh --- src/uu/cp/src/cp.rs | 46 ++++++++++++++++++++++++++++++---------- tests/by-util/test_cp.rs | 19 +++++++++++++++++ 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index de01a5ef38..d7aeea1b99 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1171,6 +1171,9 @@ pub fn copy(sources: &[PathBuf], target: &Path, options: &Options) -> CopyResult // // key is the source file's information and the value is the destination filepath. let mut copied_files: HashMap = HashMap::with_capacity(sources.len()); + // remember the copied destinations for further usage. + // we can't use copied_files as it is because the key is the source file's information. + let mut copied_destinations: HashSet = HashSet::with_capacity(sources.len()); let progress_bar = if options.progress_bar { let pb = ProgressBar::new(disk_usage(sources, options.recursive)?) @@ -1191,17 +1194,38 @@ pub fn copy(sources: &[PathBuf], target: &Path, options: &Options) -> CopyResult if seen_sources.contains(source) { // FIXME: compare sources by the actual file they point to, not their path. (e.g. dir/file == dir/../dir/file in most cases) show_warning!("source {} specified more than once", source.quote()); - } else if let Err(error) = copy_source( - &progress_bar, - source, - target, - target_type, - options, - &mut symlinked_files, - &mut copied_files, - ) { - show_error_if_needed(&error); - non_fatal_errors = true; + } else { + // We need to compute the destination path + + let dest = construct_dest_path(source, target, target_type, options) + .unwrap_or_else(|_| target.to_path_buf()); + + if fs::metadata(&dest).is_ok() && !fs::symlink_metadata(&dest)?.file_type().is_symlink() + { + // There is already a file and it isn't a symlink (managed in a different place) + if copied_destinations.contains(&dest) { + // If the target file was already created in this cp call, do not overwrite + return Err(Error::Error(format!( + "will not overwrite just-created '{}' with '{}'", + dest.display(), + source.display() + ))); + } + } + + if let Err(error) = copy_source( + &progress_bar, + source, + target, + target_type, + options, + &mut symlinked_files, + &mut copied_files, + ) { + show_error_if_needed(&error); + non_fatal_errors = true; + } + copied_destinations.insert(dest.clone()); } seen_sources.insert(source); } diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 37bec52223..5227f01944 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -3559,3 +3559,22 @@ fn test_cp_attributes_only() { assert_eq!(mode_a, at.metadata(a).mode()); assert_eq!(mode_b, at.metadata(b).mode()); } + +#[test] +fn test_cp_seen_file() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("a"); + at.mkdir("b"); + at.mkdir("c"); + at.write("a/f", "a"); + at.write("b/f", "b"); + + ucmd.arg("a/f") + .arg("b/f") + .arg("c") + .fails() + .stderr_contains("will not overwrite just-created 'c/f' with 'b/f'"); + + assert!(at.plus("c").join("f").exists()); +} From 06c98fbdd33e28110e8442dd4e6b261c3b6a1e22 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 23 Dec 2023 12:48:38 +0100 Subject: [PATCH 2/9] cp: don't fail when --backup=numbered is passed --- src/uu/cp/src/cp.rs | 4 +++- tests/by-util/test_cp.rs | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index d7aeea1b99..4d002359f9 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1203,7 +1203,9 @@ pub fn copy(sources: &[PathBuf], target: &Path, options: &Options) -> CopyResult if fs::metadata(&dest).is_ok() && !fs::symlink_metadata(&dest)?.file_type().is_symlink() { // There is already a file and it isn't a symlink (managed in a different place) - if copied_destinations.contains(&dest) { + if copied_destinations.contains(&dest) + && options.backup != BackupMode::NumberedBackup + { // If the target file was already created in this cp call, do not overwrite return Err(Error::Error(format!( "will not overwrite just-created '{}' with '{}'", diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 5227f01944..eda5dd4c6e 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -3562,7 +3562,8 @@ fn test_cp_attributes_only() { #[test] fn test_cp_seen_file() { - let (at, mut ucmd) = at_and_ucmd!(); + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; at.mkdir("a"); at.mkdir("b"); @@ -3570,11 +3571,21 @@ fn test_cp_seen_file() { at.write("a/f", "a"); at.write("b/f", "b"); - ucmd.arg("a/f") + ts.ucmd() + .arg("a/f") .arg("b/f") .arg("c") .fails() .stderr_contains("will not overwrite just-created 'c/f' with 'b/f'"); assert!(at.plus("c").join("f").exists()); + + ts.ucmd() + .arg("--backup=numbered") + .arg("a/f") + .arg("b/f") + .arg("c") + .succeeds(); + assert!(at.plus("c").join("f").exists()); + assert!(at.plus("c").join("f.~1~").exists()); } From 3af8ad0fe6b211c00df5f1c9c75fc83ba32aad1d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 23 Dec 2023 13:04:48 +0100 Subject: [PATCH 3/9] mv: manages the 'seen' file list before moving Should help with tests/mv/childproof.sh --- src/uu/mv/src/mv.rs | 17 +++++++++++++++++ tests/by-util/test_mv.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index dec6d3ad3a..75a295502c 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -10,6 +10,7 @@ mod error; use clap::builder::ValueParser; use clap::{crate_version, error::ErrorKind, Arg, ArgAction, ArgMatches, Command}; use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; +use std::collections::HashSet; use std::env; use std::ffi::OsString; use std::fs; @@ -434,6 +435,9 @@ pub fn mv(files: &[OsString], opts: &Options) -> UResult<()> { #[allow(clippy::cognitive_complexity)] fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) -> UResult<()> { + // remember the moved destinations for further usage + let mut moved_destinations: HashSet = HashSet::with_capacity(files.len()); + if !target_dir.is_dir() { return Err(MvError::NotADirectory(target_dir.quote().to_string()).into()); } @@ -471,6 +475,18 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) -> } }; + if moved_destinations.contains(&targetpath) && opts.backup != BackupMode::NumberedBackup { + // If the target file was already created in this mv call, do not overwrite + return Err(USimpleError::new( + 1, + format!( + "will not overwrite just-created '{}' with '{}'", + targetpath.display(), + sourcepath.display() + ), + )); + } + // Check if we have mv dir1 dir2 dir2 // And generate an error if this is the case if let Ok(canonicalized_source) = sourcepath.canonicalize() { @@ -513,6 +529,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) -> if let Some(ref pb) = count_progress { pb.inc(1); } + moved_destinations.insert(targetpath.clone()); } Ok(()) } diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 75500ac63d..2e2dc3d81e 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -1469,6 +1469,32 @@ fn test_mv_file_into_dir_where_both_are_files() { .stderr_contains("mv: failed to access 'b/': Not a directory"); } +#[test] +fn test_mv_seen_file() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + + at.mkdir("a"); + at.mkdir("b"); + at.mkdir("c"); + at.write("a/f", "a"); + at.write("b/f", "b"); + + ts.ucmd() + .arg("a/f") + .arg("b/f") + .arg("c") + .fails() + .stderr_contains("will not overwrite just-created 'c/f' with 'b/f'"); + + // a/f has been moved into c/f + assert!(at.plus("c").join("f").exists()); + // b/f still exists + assert!(at.plus("b").join("f").exists()); + // a/f no longer exists + assert!(!at.plus("a").join("f").exists()); +} + #[test] fn test_mv_dir_into_file_where_both_are_files() { let scene = TestScenario::new(util_name!()); From 9c7fd5e8cb1f5736235461ed521102b9182a538d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 23 Dec 2023 13:05:52 +0100 Subject: [PATCH 4/9] mv: rename the variable to match the name in cp --- src/uu/mv/src/mv.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 75a295502c..058532851b 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -434,7 +434,7 @@ pub fn mv(files: &[OsString], opts: &Options) -> UResult<()> { } #[allow(clippy::cognitive_complexity)] -fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) -> UResult<()> { +fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, options: &Options) -> UResult<()> { // remember the moved destinations for further usage let mut moved_destinations: HashSet = HashSet::with_capacity(files.len()); @@ -446,7 +446,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) -> .canonicalize() .unwrap_or_else(|_| target_dir.to_path_buf()); - let multi_progress = opts.progress_bar.then(MultiProgress::new); + let multi_progress = options.progress_bar.then(MultiProgress::new); let count_progress = if let Some(ref multi_progress) = multi_progress { if files.len() > 1 { @@ -475,7 +475,8 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) -> } }; - if moved_destinations.contains(&targetpath) && opts.backup != BackupMode::NumberedBackup { + if moved_destinations.contains(&targetpath) && options.backup != BackupMode::NumberedBackup + { // If the target file was already created in this mv call, do not overwrite return Err(USimpleError::new( 1, @@ -509,7 +510,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, opts: &Options) -> } } - match rename(sourcepath, &targetpath, opts, multi_progress.as_ref()) { + match rename(sourcepath, &targetpath, options, multi_progress.as_ref()) { Err(e) if e.to_string().is_empty() => set_exit_code(1), Err(e) => { let e = e.map_err_context(|| { From c94773f522bdaa5f9c01b9242e912ad8af885605 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 23 Dec 2023 13:27:00 +0100 Subject: [PATCH 5/9] mv: make sure it continues when hiting an error --- src/uu/mv/src/mv.rs | 3 ++- tests/by-util/test_mv.rs | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 058532851b..ff5aaf93d5 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -478,7 +478,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, options: &Options) if moved_destinations.contains(&targetpath) && options.backup != BackupMode::NumberedBackup { // If the target file was already created in this mv call, do not overwrite - return Err(USimpleError::new( + show!(USimpleError::new( 1, format!( "will not overwrite just-created '{}' with '{}'", @@ -486,6 +486,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, options: &Options) sourcepath.display() ), )); + continue; } // Check if we have mv dir1 dir2 dir2 diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 2e2dc3d81e..bc75ada3fa 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -1495,6 +1495,32 @@ fn test_mv_seen_file() { assert!(!at.plus("a").join("f").exists()); } +#[test] +fn test_mv_seen_multiple_files_to_directory() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + + at.mkdir("a"); + at.mkdir("b"); + at.mkdir("c"); + at.write("a/f", "a"); + at.write("b/f", "b"); + at.write("b/g", "g"); + + ts.ucmd() + .arg("a/f") + .arg("b/f") + .arg("b/g") + .arg("c") + .fails() + .stderr_contains("will not overwrite just-created 'c/f' with 'b/f'"); + assert!(!at.plus("a").join("f").exists()); + assert!(at.plus("b").join("f").exists()); + assert!(!at.plus("b").join("g").exists()); + assert!(at.plus("c").join("f").exists()); + assert!(at.plus("c").join("g").exists()); +} + #[test] fn test_mv_dir_into_file_where_both_are_files() { let scene = TestScenario::new(util_name!()); From ceecac110c6a6db324a0766fc0909b4586b5b3ad Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 23 Dec 2023 13:43:11 +0100 Subject: [PATCH 6/9] ln: manages the 'seen' file list before linking Should help with tests/mv/childproof.sh --- src/uu/ln/src/ln.rs | 15 +++++++++++++- tests/by-util/test_ln.rs | 43 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index 8b76aa73c0..e53af03a24 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -12,6 +12,7 @@ use uucore::fs::{make_path_relative_to, paths_refer_to_same_file}; use uucore::{format_usage, help_about, help_section, help_usage, prompt_yes, show_error}; use std::borrow::Cow; +use std::collections::HashSet; use std::error::Error; use std::ffi::OsString; use std::fmt::Display; @@ -295,6 +296,8 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) if !target_dir.is_dir() { return Err(LnError::TargetIsDirectory(target_dir.to_owned()).into()); } + // remember the linked destinations for further usage + let mut linked_destinations: HashSet = HashSet::with_capacity(files.len()); let mut all_successful = true; for srcpath in files { @@ -338,10 +341,20 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) } }; - if let Err(e) = link(srcpath, &targetpath, settings) { + if linked_destinations.contains(&targetpath) { + // If the target file was already created in this linked call, do not overwrite + show_error!( + "will not overwrite just-created '{}' with '{}'", + targetpath.display(), + srcpath.display() + ); + all_successful = false; + } else if let Err(e) = link(srcpath, &targetpath, settings) { show_error!("{}", e); all_successful = false; } + + linked_destinations.insert(targetpath.clone()); } if all_successful { Ok(()) diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index dc31f72611..b6453bf437 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -3,6 +3,8 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. use crate::common::util::TestScenario; +#[cfg(unix)] +use std::os::unix::fs::MetadataExt; use std::path::PathBuf; #[test] @@ -719,3 +721,44 @@ fn test_symlink_remove_existing_same_src_and_dest() { assert!(at.file_exists("a") && !at.symlink_exists("a")); assert_eq!(at.read("a"), "sample"); } + +#[test] +fn test_ln_seen_file() { + let ts = TestScenario::new(util_name!()); + let at = &ts.fixtures; + + at.mkdir("a"); + at.mkdir("b"); + at.mkdir("c"); + at.write("a/f", "a"); + at.write("b/f", "b"); + + ts.ucmd() + .arg("a/f") + .arg("b/f") + .arg("c") + .fails() + .stderr_contains("will not overwrite just-created 'c/f' with 'b/f'"); + + assert!(at.plus("c").join("f").exists()); + // b/f still exists + assert!(at.plus("b").join("f").exists()); + // a/f no longer exists + assert!(at.plus("a").join("f").exists()); + #[cfg(unix)] + { + // Check inode numbers + let inode_a_f = at.plus("a").join("f").metadata().unwrap().ino(); + let inode_b_f = at.plus("b").join("f").metadata().unwrap().ino(); + let inode_c_f = at.plus("c").join("f").metadata().unwrap().ino(); + + assert_eq!( + inode_a_f, inode_c_f, + "Inode numbers of a/f and c/f should be equal" + ); + assert_ne!( + inode_b_f, inode_c_f, + "Inode numbers of b/f and c/f should not be equal" + ); + } +} From 15573579cc4d043d6505011becbf82966f5d52b0 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 24 Dec 2023 15:18:31 +0100 Subject: [PATCH 7/9] Fix the windows tests --- tests/by-util/test_cp.rs | 15 +++++++++------ tests/by-util/test_ln.rs | 16 ++++++++++------ tests/by-util/test_mv.rs | 33 ++++++++++++++++++++------------- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index eda5dd4c6e..07b9620a63 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -3571,12 +3571,15 @@ fn test_cp_seen_file() { at.write("a/f", "a"); at.write("b/f", "b"); - ts.ucmd() - .arg("a/f") - .arg("b/f") - .arg("c") - .fails() - .stderr_contains("will not overwrite just-created 'c/f' with 'b/f'"); + let result = ts.ucmd().arg("a/f").arg("b/f").arg("c").fails(); + #[cfg(not(unix))] + assert!(result + .stderr_str() + .contains("will not overwrite just-created 'c\\f' with 'b/f'")); + #[cfg(unix)] + assert!(result + .stderr_str() + .contains("will not overwrite just-created 'c/f' with 'b/f'")); assert!(at.plus("c").join("f").exists()); diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index b6453bf437..e51d99732c 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -733,12 +733,16 @@ fn test_ln_seen_file() { at.write("a/f", "a"); at.write("b/f", "b"); - ts.ucmd() - .arg("a/f") - .arg("b/f") - .arg("c") - .fails() - .stderr_contains("will not overwrite just-created 'c/f' with 'b/f'"); + let result = ts.ucmd().arg("a/f").arg("b/f").arg("c").fails(); + + #[cfg(not(unix))] + assert!(result + .stderr_str() + .contains("will not overwrite just-created 'c\\f' with 'b/f'")); + #[cfg(unix)] + assert!(result + .stderr_str() + .contains("will not overwrite just-created 'c/f' with 'b/f'")); assert!(at.plus("c").join("f").exists()); // b/f still exists diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index bc75ada3fa..61a4aebf65 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -1480,12 +1480,16 @@ fn test_mv_seen_file() { at.write("a/f", "a"); at.write("b/f", "b"); - ts.ucmd() - .arg("a/f") - .arg("b/f") - .arg("c") - .fails() - .stderr_contains("will not overwrite just-created 'c/f' with 'b/f'"); + let result = ts.ucmd().arg("a/f").arg("b/f").arg("c").fails(); + + #[cfg(not(unix))] + assert!(result + .stderr_str() + .contains("will not overwrite just-created 'c\\f' with 'b/f'")); + #[cfg(unix)] + assert!(result + .stderr_str() + .contains("will not overwrite just-created 'c/f' with 'b/f'")); // a/f has been moved into c/f assert!(at.plus("c").join("f").exists()); @@ -1507,13 +1511,16 @@ fn test_mv_seen_multiple_files_to_directory() { at.write("b/f", "b"); at.write("b/g", "g"); - ts.ucmd() - .arg("a/f") - .arg("b/f") - .arg("b/g") - .arg("c") - .fails() - .stderr_contains("will not overwrite just-created 'c/f' with 'b/f'"); + let result = ts.ucmd().arg("a/f").arg("b/f").arg("b/g").arg("c").fails(); + #[cfg(not(unix))] + assert!(result + .stderr_str() + .contains("will not overwrite just-created 'c\\f' with 'b/f'")); + #[cfg(unix)] + assert!(result + .stderr_str() + .contains("will not overwrite just-created 'c/f' with 'b/f'")); + assert!(!at.plus("a").join("f").exists()); assert!(at.plus("b").join("f").exists()); assert!(!at.plus("b").join("g").exists()); From f86e314f4686f912c91fa1cf4c4f95c7f856dd5c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 25 Dec 2023 09:47:37 +0100 Subject: [PATCH 8/9] Fix some obvious comment Co-authored-by: Daniel Hofstetter --- src/uu/cp/src/cp.rs | 2 -- src/uu/ln/src/ln.rs | 2 +- tests/by-util/test_ln.rs | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 4d002359f9..72bfbf54e5 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -1195,8 +1195,6 @@ pub fn copy(sources: &[PathBuf], target: &Path, options: &Options) -> CopyResult // FIXME: compare sources by the actual file they point to, not their path. (e.g. dir/file == dir/../dir/file in most cases) show_warning!("source {} specified more than once", source.quote()); } else { - // We need to compute the destination path - let dest = construct_dest_path(source, target, target_type, options) .unwrap_or_else(|_| target.to_path_buf()); diff --git a/src/uu/ln/src/ln.rs b/src/uu/ln/src/ln.rs index e53af03a24..a056ee256a 100644 --- a/src/uu/ln/src/ln.rs +++ b/src/uu/ln/src/ln.rs @@ -342,7 +342,7 @@ fn link_files_in_dir(files: &[PathBuf], target_dir: &Path, settings: &Settings) }; if linked_destinations.contains(&targetpath) { - // If the target file was already created in this linked call, do not overwrite + // If the target file was already created in this ln call, do not overwrite show_error!( "will not overwrite just-created '{}' with '{}'", targetpath.display(), diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index e51d99732c..78978a06ea 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -747,7 +747,7 @@ fn test_ln_seen_file() { assert!(at.plus("c").join("f").exists()); // b/f still exists assert!(at.plus("b").join("f").exists()); - // a/f no longer exists + // a/f still exists assert!(at.plus("a").join("f").exists()); #[cfg(unix)] { From 60d71e3f2a855925fe526e3df0a36accf959774d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 25 Dec 2023 11:22:04 +0100 Subject: [PATCH 9/9] ln: disable a test on android --- tests/by-util/test_ln.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_ln.rs b/tests/by-util/test_ln.rs index 78978a06ea..2501e9d362 100644 --- a/tests/by-util/test_ln.rs +++ b/tests/by-util/test_ln.rs @@ -723,6 +723,7 @@ fn test_symlink_remove_existing_same_src_and_dest() { } #[test] +#[cfg(not(target_os = "android"))] fn test_ln_seen_file() { let ts = TestScenario::new(util_name!()); let at = &ts.fixtures;