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

Symlink forest should respect .bazelignore #16842

Closed
KrauseStefan opened this issue Nov 24, 2022 · 5 comments
Closed

Symlink forest should respect .bazelignore #16842

KrauseStefan opened this issue Nov 24, 2022 · 5 comments
Labels
help wanted Someone outside the Bazel team could own this P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug

Comments

@KrauseStefan
Copy link

KrauseStefan commented Nov 24, 2022

Description of the bug:

The symlink forest does not respect the .bazelignore file, this was unexpected behavior, and in my situation led to non hermetic builds that poised a shared build cache.

In our case it was the node_modules folder that is moved from being referenced using the now deprecated/removed managed_directories feature (#15463)

It is ignored since we do not want Bazel to be able to depend on this folder even by accident, but since it is linked in it still can happen.

This does not fix hermitic problems for local/worker builds but it does remove one source.

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

clone the demo repo here and run ./demo.sh.
Note that the genrule can access the content of the ignored_directory even though it is in the .bazelignnore

https://github.com/KrauseStefan/bazel_issue_16842_demo/tree/main

Which operating system are you running Bazel on?

WSL / Native Windows

What is the output of bazel info release?

release 5.3.2

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 ?

No response

Have you found anything relevant by searching the web?

I tracked down the place where the symlinks are created, ignorering top level folders would have been easy but I realise that this would complicate the code a bit, so the question is also would you be interested in the .ignorebazel to be respected in context of the Symlink forest?

SymlinkForest.java:127

Extra context
Obviously a build cache can be poised any an almost infinite number of way when we update it from local developers machines with the local/worker strategy that is also why the cache is a dev only cache, CI has its own and uses the sandbox strateg.
There are some politics that prevent us from using the same cache as CI even if read-only.
Essentially a tradeoff between speed and hermicity.

I was very much in doubt if this should be a bug or a feature request, but decided on bug since this is mostly about unexpected behavior.

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

No response

@sgowroji sgowroji added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. more data needed type: bug labels Nov 27, 2022
@sgowroji
Copy link
Member

Hello @KrauseStefan, Could you please provide minimal steps followed to reproduce the above issue. Thanks!

@KrauseStefan
Copy link
Author

KrauseStefan commented Nov 28, 2022

I created a repo that reproduces the issues with a genrule, and updated the original post.

@meteorcloudy meteorcloudy added P2 We'll consider working on this in future. (Assignee optional) help wanted Someone outside the Bazel team could own this and removed untriaged labels Dec 6, 2022
@KrauseStefan
Copy link
Author

This has now been open for quite a while, is this something that has a realistic chance of getting fixed?
If not could you provide some pointers as to what an acceptable fix would need to do.

It would fix my immediate issue if the support was added for the root directory only, it seems like that would be pretty easy to just skip creating that symlink if it specifically is defined in the .ignorebazel.

Since it does not cover all cases will it need to be hidden behind a flag?

I'm not sure who to ping, so apologies if I picked the wrong person.
@meteorcloudy

@fmeum
Copy link
Collaborator

fmeum commented Jan 17, 2024

Have you tested Bazel 7 with e1fbc83? Sounds like it could have fixed the problem.

@KrauseStefan
Copy link
Author

It seems you are right, closing.
Thank you 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Someone outside the Bazel team could own this P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug
Projects
None yet
Development

No branches or pull requests

4 participants