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

Option to use copies of input files rather than symlinks in genrule, sh_test, etc #18383

Open
njlr opened this issue May 12, 2023 · 1 comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Local-Exec Issues and PRs for the Execution (Local) team type: feature request

Comments

@njlr
Copy link

njlr commented May 12, 2023

Description of the feature request:

Some tools (such as Docker) work differently when a file is symlink rather than just the file.

Bazel creates symlinks as an optimization, but sometimes this changes the behaviour of the rule.

Bazel should provide the option to disable symlinks and copy the files on a rule-basis.

sh_test(
  name = "test",
  srcs = [ "test.sh" ],
  args = [
    "$(location :docker-compose.yaml)",
  ],
  data = [
    "docker-compose.yaml",
  ],
  # Input files will be copied into the sandbox rather than placed as symlinks
  disable_sandbox_symlinks = True, # Defaults to false, so this is a non-breaking change
)

What underlying problem are you trying to solve with this feature?

Make it easier to work with tools from Bazel.

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

release 5.4.0

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

No response

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

N/A

Have you found anything relevant by searching the web?

Maybe related: #4320

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

No response

@tjgq
Copy link
Contributor

tjgq commented May 12, 2023

FYI, there's also a sandbox implementation based on hardlinks (which uses hardlinks when on the same fs, and makes a copy otherwise). You can enable it with --experimental_use_hermetic_linux_sandbox, but note the caveat in #18377. But you can only set it for the entire invocation, not for individual actions.

@tjgq tjgq added the team-Local-Exec Issues and PRs for the Execution (Local) team label May 12, 2023
@coeuvre coeuvre added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Local-Exec Issues and PRs for the Execution (Local) team type: feature request
Projects
None yet
Development

No branches or pull requests

5 participants