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

platformclasspath_classes folder not writable since 6.0.0-pre.20220517.1 #15616

Closed
deepy opened this issue Jun 3, 2022 · 5 comments
Closed
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-Java Issues for Java rules type: support / not a bug (process)

Comments

@deepy
Copy link

deepy commented Jun 3, 2022

Description of the bug:

Starting in 6.0.0-pre.20220517.1 the platformclasspath_classes is no longer writable which prevents DumpPlatformClassPath.class from being deleted.
This is causing our tests to fail when trying to cleanup or work with the directory.

rm: cannot remove '/home/deepy/.cache/bazel/_bazel_deepy/8edfe17b4be90513bcf6c070303d6f06/execroot/__main__/bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath_classes/DumpPlatformClassPath.class': Permission denied
$ ls -la .
dr-xr-xr-x 2 deepy deepy  4096 Jun  3 10:20 .
drwxr-xr-x 3 deepy deepy  4096 Jun  3 10:20 ..
-r-xr-xr-x 1 deepy deepy 10139 Jun  3 10:20 DumpPlatformClassPath.class

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

Build examples/java-tutorial with --output_base

bazel --output_base=mytest build //:ProjectRunner

Then rm -rf mytest

rm: cannot remove './mytest/execroot/__main__/bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath_classes/DumpPlatformClassPath.class': Permission denied

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

6.0.0-pre.20220526.1

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?

No response

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

No response

@fmeum
Copy link
Collaborator

fmeum commented Jun 3, 2022

This changed with ae523f8. Before that commit, the output of the action that compiles DumpPlatformClassPath was a non-writable class file, now it is a non-writable directory containing a class file. The same would apply to any other directory output produced by a Bazel rule. While probably working as intended from the perspective of Bazel (rule outputs that are used as inputs should not be writable), it is inconvenient that a simple rm -rf isn't able to remove the tree.

@deepy Can you use chmod -R u=rwx mytest before doing the rm -rf mytest?

@deepy
Copy link
Author

deepy commented Jun 3, 2022

The problem there is that when we add changing permissions into the mix we can't rely on automatic cleanup by other tools any longer and with multiple operating systems in the mix this becomes even less fun to deal with.
And if we delete it too eagerly it's going to impact test execution times 😞

@fmeum
Copy link
Collaborator

fmeum commented Jun 5, 2022

Have you tried bazel clean --expunge --output_base=mytest? This is Bazel-specific, but should work on all OSes.

@comius comius added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed untriaged labels Jun 10, 2022
@deepy
Copy link
Author

deepy commented Jun 14, 2022

We've worked around this, thank you for the explanation, all the information, and the workaround suggestions!

@hashar
Copy link
Contributor

hashar commented Oct 7, 2022

I encounter the same issue with Bazel 5.3.1. To start a fresh build we do find bazel-out -delete and that chokes on the lack of writable permission (see also our issue tracker)

wmfgerrit pushed a commit to wikimedia/integration-zuul-config that referenced this issue Jan 5, 2023
Bazel output of the action that compiles `DumpPlatformClassPath` is
written in a non -writable directory. When we wipe the `log` directory
with `find log/ --delete` that results in:

/usr/bin/find: cannot delete ‘/workspace/log/execroot/eventsWikimedia
 /bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/jdk
 /platformclasspath_classes/DumpPlatformClassPath.class’: Permission denied

Unconditionally create the `log` directory and ensure all files are
writables before deletion.

Update gerrit-events-wikimedia-bazel-docker

Bazel issue bazelbuild/bazel#15616

Bug: T320251
Change-Id: Ia6dafa3e9bacd81c03e9ec35644c8a2893368e03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) team-Rules-Java Issues for Java rules type: support / not a bug (process)
Projects
None yet
Development

No branches or pull requests

5 participants