From 6b6efeb08973701948a8e04b093a8056fc914656 Mon Sep 17 00:00:00 2001 From: o0Ignition0o Date: Fri, 13 Jun 2025 09:42:23 +0200 Subject: [PATCH] Fix: fix osx cp warning. On macos, cp's `--no-preserve` option does not exist. It is enabled by default, and can be disabled with the explicit `-p` (preserve) flag. This lead libsql-ffi's build.rs to warn about an illegal option used: ``` cp: illegal option -- - usage: cp [-R [-H | -L | -P]] [-fi | -n] [-aclpSsvXx] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-aclpSsvXx] source_file ... target_directory ``` This changeset makes sure the option is only passed in non `macos` target_os. --- libsql-ffi/build.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libsql-ffi/build.rs b/libsql-ffi/build.rs index 90f6c0150b..193e161ecd 100644 --- a/libsql-ffi/build.rs +++ b/libsql-ffi/build.rs @@ -76,8 +76,12 @@ fn copy_dir_all(src: impl AsRef, dst: impl AsRef) -> io::Result<()> /// propagate into OUT_DIR. If not present, when trying to rewrite a file, a `Permission denied` /// error will occur. fn copy_with_cp(from: impl AsRef, to: impl AsRef) -> io::Result<()> { - match Command::new("cp") - .arg("--no-preserve=mode,ownership") + let mut command = Command::new("cp"); + // --no-preserve is enabled by default on macos + // preserve must be explicitly enabled with the -p flag + #[cfg(not(target_os = "macos"))] + let command = command.arg("--no-preserve=mode,ownership"); + match command .arg("-R") .arg(from.as_ref().to_str().unwrap()) .arg(to.as_ref().to_str().unwrap())