Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executable bit not being set with (--remote_download_minimal or --remote_download_toplevel) and --define=apple.experimental.tree_artifact_outputs=1 #16754

Closed
codeman9 opened this issue Nov 11, 2022 · 5 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Remote-Exec Issues and PRs for the Execution (Remote) team type: bug

Comments

@codeman9
Copy link

codeman9 commented Nov 11, 2022

Description of the bug:

Prior to this commit: dfccbf9, our iOS app was getting the executable bit set, as it should. After that commit, the app no longer has the executable bit set. This only happens using either --remote_download_minimal or --remote_download_toplevel.

There may be a correlation to this flag: --define=apple.experimental.tree_artifact_outputs=1. (see repro steps)

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

incremental-alley.zip

# .bazelversion
b8d0e26357065740d4007223cf20f488a120290e
# ^--- Works no matter what

# dfccbf975358da93a5ef0fe0f9438873e2a06ee5
# ^--- Doesn't work with --remote_download_toplevel and --define=apple.experimental.tree_artifact_outputs=1

# 6.0.0rc1
# and later
# ^--- Doesn't work with --remote_download_toplevel and --define=apple.experimental.tree_artifact_outputs=1

Between trials below, be sure to bazel clean and when going from Works -> Doesn't work and back, be sure to rm -rf ~/.bazel_cache_incremental_alley

Works as expected:

  1. Unzip the attached
# .bazelrc
build \
  --disk_cache=~/.bazel_cache_incremental_alley \
  --execution_log_json_file=tmp/logs/execution.json \
  --features=swift.partially_explicit_modules \
  --features=swift.use_global_module_cache \
  --swiftcopt=-enable-incremental-imports \
  --remote_download_toplevel
  1. Run bazel build :IncrementalAlley-iOS
  2. Change the name of bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.ipa to /private/var/tmp/_bazel_user/3af7db76104a2df6189bfd78bfcdce2e/execroot/__main__/bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.zip and unzip
  3. ls -l bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/Payload/IncrementalAlley-iOS.app/IncrementalAlley-iOS

Observe something like the following (notice the executable bits set):

-rwxr-xr-x  1 user  staff  121808 Jan  1  1980 /private/var/tmp/_bazel_user/3af7db76104a2df6189bfd78bfcdce2e/execroot/__main__/bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/Payload/IncrementalAlley-iOS.app/IncrementalAlley-iOS

Works as expected:

  1. Unzip the attached
# .bazelrc
build \
  --disk_cache=~/.bazel_cache_incremental_alley \
  --execution_log_json_file=tmp/logs/execution.json \
  --features=swift.partially_explicit_modules \
  --features=swift.use_global_module_cache \
  --swiftcopt=-enable-incremental-imports
  # removed --remote_download_toplevel
  1. Run bazel build :IncrementalAlley-iOS
  2. Change the name of bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.ipa to /private/var/tmp/_bazel_user/3af7db76104a2df6189bfd78bfcdce2e/execroot/__main__/bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.zip and unzip
  3. ls -l bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/Payload/IncrementalAlley-iOS.app/IncrementalAlley-iOS

Observe something like the following (notice the executable bits set):

-rwxr-xr-x  1 user  staff  121808 Jan  1  1980 /private/var/tmp/_bazel_user/3af7db76104a2df6189bfd78bfcdce2e/execroot/__main__/bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/Payload/IncrementalAlley-iOS.app/IncrementalAlley-iOS

Works as expected:

  1. Unzip the attached
# .bazelrc
build \
  --disk_cache=~/.bazel_cache_incremental_alley \
  --execution_log_json_file=tmp/logs/execution.json \
  --features=swift.partially_explicit_modules \
  --features=swift.use_global_module_cache \
  --swiftcopt=-enable-incremental-imports \
  --define=apple.experimental.tree_artifact_outputs=1 # <--- added this flag which skips the .ipa and creates .app
  1. Run bazel build :IncrementalAlley-iOS
  2. Change the name of bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.ipa to /private/var/tmp/_bazel_user/3af7db76104a2df6189bfd78bfcdce2e/execroot/__main__/bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.zip and unzip
  3. ls -l bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.app/IncrementalAlley-iOS

Observe something like the following (notice the executable bits set) (also notice that the write flag is no longer set):

-r-xr-xr-x  1 user  staff  121808 Jan  1  1980  /private/var/tmp/_bazel_user/3af7db76104a2df6189bfd78bfcdce2e/execroot/__main__/bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.app/IncrementalAlley-iOS

Does not work as expected:

  1. Unzip the attached
# .bazelrc
build \
  --disk_cache=~/.bazel_cache_incremental_alley \
  --execution_log_json_file=tmp/logs/execution.json \
  --features=swift.partially_explicit_modules \
  --features=swift.use_global_module_cache \
  --swiftcopt=-enable-incremental-imports \
  --remote_download_toplevel \ # <--- added this back
  --define=apple.experimental.tree_artifact_outputs=1 # <--- added this flag which skips the .ipa and creates .app
  1. Run bazel build :IncrementalAlley-iOS
  2. Change the name of bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.ipa to /private/var/tmp/_bazel_user/3af7db76104a2df6189bfd78bfcdce2e/execroot/__main__/bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.zip and unzip
  3. ls -l bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.app/IncrementalAlley-iOS

Observe something like the following (notice the executable bits are not set):

-rw-r--r--  1 user  staff  121808 Jan  1  1980  /private/var/tmp/_bazel_user/3af7db76104a2df6189bfd78bfcdce2e/execroot/__main__/bazel-out/applebin_ios-ios_sim_arm64-fastbuild-ST-9c82d69884d3/bin/Modules/iOSApp/IncrementalAlley-iOS.app/IncrementalAlley-iOS

Which operating system are you running Bazel on?

macOS Ventura 13.0

What is the output of bazel info release?

2022/11/11 15:34:12 Using unreleased version at commit b8d0e26 INFO: Invocation ID: 8a3b1297-1269-45f1-8ed9-87a8abe14154 development version

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

Using bazelisk

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

[email protected]:bazelbuild/bazel.git
839ce7f5c40240d8b6f49c416c3769e226f43fee
839ce7f5c40240d8b6f49c416c3769e226f43fee

Have you found anything relevant by searching the web?

Not really. There are some issues regarding executable bits like this one: #12137 but it didn't seem exactly relevant.

Any other information, logs, or outputs that you want to share?

No response

@keith
Copy link
Member

keith commented Nov 11, 2022

cc @tjgq

@sgowroji sgowroji added team-Remote-Exec Issues and PRs for the Execution (Remote) team untriaged type: bug labels Nov 12, 2022
@coeuvre coeuvre added P1 I'll work on this now. (Assignee required) release blocker and removed untriaged labels Nov 22, 2022
@tjgq
Copy link
Contributor

tjgq commented Nov 29, 2022

@keith Thanks for the detailed repro and for bisecting the culprit!

Assuming I've followed the instructions correctly, I believe this has been fixed by 29ee191 (which will be cherry-picked into 6.0.0 in #16879). Could you please confirm that the fix works for you?

@keith
Copy link
Member

keith commented Nov 29, 2022

hopefully @codeman9 who did the work here can test that one

@codeman9
Copy link
Author

@tjgq Using this commit has solved this issue. Thanks!

@coeuvre
Copy link
Member

coeuvre commented Nov 30, 2022

Thanks for confirming!

@coeuvre coeuvre closed this as completed Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Remote-Exec Issues and PRs for the Execution (Remote) team type: bug
Projects
None yet
Development

No branches or pull requests

5 participants