-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Java RUNFILES_MANIFEST logic is lacking #20676
Comments
Hi @DavidZbarsky-at, Can you provide complete steps to reproduce at our end. Thanks! |
Here's the setup:
You can repro the failure with Note that |
The reproducer passes for me with Not trying to make this more complicated then it needs to be, but I think that the real root cause of this is a design issue rather than a bug. The proper fix would be to get rid of For example, we may be able to check whether the runfiles directory is populated by looking for any directory under it - unfortunately, pre-Bzlmod the workspace name isn't fixed, so we can't just look for its directory. @lberki @tjgq Do you see any potential problems with such an approach? Also @laszlocsomor in case you still like to think about runfiles questions :-) |
Fixes two separate but related issues: * On all OSes, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from on to off did not result in runfiles being cleared due to a missing call to `SymlinkTreeHelper#clearRunfilesDirectory` that was only added to `SymlinkTreeStrategy` in f84329e. * On Windows only, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from off to on did not result in runfiles being created since the logic in `RunfilesTreeUpdater` would see a copy of the manifest instead of a symlink. Work towards bazelbuild#20676 Fixes bazelbuild#19333
Fixes two separate but related issues: * On all OSes, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from on to off did not result in runfiles being cleared due to a missing call to `SymlinkTreeHelper#clearRunfilesDirectory` that was only added to `SymlinkTreeStrategy` in f84329e. * On Windows only, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from off to on did not result in runfiles being created since the logic in `RunfilesTreeUpdater` would see a copy of the manifest instead of a symlink. Work towards bazelbuild#20676 Fixes bazelbuild#19333
Fixes two separate but related issues: * On all OSes, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from on to off did not result in runfiles being cleared due to a missing call to `SymlinkTreeHelper#clearRunfilesDirectory` that was only added to `SymlinkTreeStrategy` in f84329e. * On Windows only, with `--nobuild_runfile_links`, flipping `--enable_runfiles` from off to on did not result in runfiles being created since the logic in `RunfilesTreeUpdater` would see a copy of the manifest instead of a symlink. Work towards bazelbuild#20676 Fixes bazelbuild#19333
Yeah, checking whether the runfiles tree exists at run-time instead of using an environment variable that is not even correct in some cases sounds like a better approach. @hvadehra WDYT? (the runfiles logic in Bazel is kinda crufty; I'm trying to fix it bit by bit whenever I have the time, but there is only so much I can do in my discretionary time) |
I am fixing some incrementality issues with the runfiles directory in #20695. Along the way, I also found that I need some way to distinguish an "empty" runfiles directory (with |
Fixes three separate but related issues with `--nobuild_runfile_links`: * On all OSes, flipping `--enable_runfiles` from on to off did not result in runfiles being cleared due to a missing call to `SymlinkTreeHelper#clearRunfilesDirectory` that was only added to `SymlinkTreeStrategy` in f84329e. * On Windows only, flipping `--enable_runfiles` from off to on did not result in runfiles being created since the logic in `RunfilesTreeUpdater` would see a copy of the manifest instead of a symlink. This is fixed by additionally checking whether the runfiles directory contains the first runfile on Windows. If runfiles were disabled before, it won't, otherwise it will. * On all OSes, `--noenable_runfiles` was ignored by `bazel run`, with runfiles always being created. This is fixed by using `RunfilesTreeUpdater` instead of custom and incorrect logic. With the fixed behavior, the runfiles tree for tests is now cleared right before the test spawn is executed, which makes the test action unable to create its working directory, the subdirectory of the runfiles directory corresponding to the workspace name. To fix this and also get rid of the inconsistency of having another action write into the runfiles tree, this logic is moved into the `SymlinkTreeHelper` and thus applied to all runfiles trees. Work towards #20676 Fixes #19333 Closes #20695. PiperOrigin-RevId: 595369235 Change-Id: I32efc0e6a1d29291470ce5eafcc69bbd9ab276b9
Description of the bug:
This logic seem incorrect in recent Bazel nightlies. I would expect it to look more like so.
This breaks Java builds with
--noenable_runfiles
, especially anything usingrules_jvm_external
since it has an internal java binary (AddJarManifestEntry
) that it runs on 3p deps, which fails at runtime with the following:Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
No response
Which operating system are you running Bazel on?
OSX
What is the output of
bazel info release
?release 7.0.0
If
bazel info release
returnsdevelopment 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
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
Yes, presumably from when the manifest file location changed name.
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: