From 7f854f48fbedd5736b75b9b89b3cfc02d98beab6 Mon Sep 17 00:00:00 2001 From: Thiago Cruz Date: Thu, 8 May 2025 16:34:22 -0400 Subject: [PATCH] Fix an rsync issue causing "Permission denied" errors Signed-off-by: Thiago Cruz --- xcodeproj/internal/bazel_integration_files/copy_dsyms.sh | 3 +++ xcodeproj/internal/bazel_integration_files/copy_outputs.sh | 3 +++ xcodeproj/internal/templates/incremental_installer.sh | 3 +++ xcodeproj/internal/templates/legacy_installer.sh | 3 +++ 4 files changed, 12 insertions(+) diff --git a/xcodeproj/internal/bazel_integration_files/copy_dsyms.sh b/xcodeproj/internal/bazel_integration_files/copy_dsyms.sh index 900aa664e..f70a7a171 100644 --- a/xcodeproj/internal/bazel_integration_files/copy_dsyms.sh +++ b/xcodeproj/internal/bazel_integration_files/copy_dsyms.sh @@ -63,6 +63,9 @@ if [[ -n "${BAZEL_OUTPUTS_DSYM:-}" ]]; then $(xargs -n1 <<< "$BAZEL_OUTPUTS_DSYM") \ "$TARGET_BUILD_DIR" + # Works around an rsync issue causing "Permission denied" errors + chmod +w "$TARGET_BUILD_DIR" + cd "${TARGET_BUILD_DIR}" export -f patch_dsym diff --git a/xcodeproj/internal/bazel_integration_files/copy_outputs.sh b/xcodeproj/internal/bazel_integration_files/copy_outputs.sh index f3e59f10d..90c18f61d 100755 --- a/xcodeproj/internal/bazel_integration_files/copy_outputs.sh +++ b/xcodeproj/internal/bazel_integration_files/copy_outputs.sh @@ -43,6 +43,9 @@ if [[ "$ACTION" != indexbuild ]]; then "$BAZEL_OUTPUTS_PRODUCT_BASENAME" \ "$TARGET_BUILD_DIR" + # Works around an rsync issue causing "Permission denied" errors + chmod +w "$TARGET_BUILD_DIR" + if [[ -n "${TEST_HOST:-}" ]]; then # We need to re-sign test frameworks that Xcode placed into the test # host un-signed diff --git a/xcodeproj/internal/templates/incremental_installer.sh b/xcodeproj/internal/templates/incremental_installer.sh index ee47b5a72..09df3dda9 100644 --- a/xcodeproj/internal/templates/incremental_installer.sh +++ b/xcodeproj/internal/templates/incremental_installer.sh @@ -82,6 +82,9 @@ rsync \ --delete \ "$src_xcschemes" "$dest_xcschemes/" +# Works around an rsync issue causing "Permission denied" errors +chmod +w "$dest_xcschemes/" + if [[ $(uname) == "Darwin" ]]; then is_macos=1 else diff --git a/xcodeproj/internal/templates/legacy_installer.sh b/xcodeproj/internal/templates/legacy_installer.sh index 8e37dad76..fe32435af 100644 --- a/xcodeproj/internal/templates/legacy_installer.sh +++ b/xcodeproj/internal/templates/legacy_installer.sh @@ -148,6 +148,9 @@ rsync \ --delete \ "$src/" "$dest/" +# Works around an rsync issue causing "Permission denied" errors +chmod +w "$dest/" + # Copy over the bazel integration files mkdir -p "$dest/rules_xcodeproj/bazel" rm -rf "$dest/rules_xcodeproj/bazel"/*