bazelbuild / rules_python

Bazel Python Rules
https://rules-python.readthedocs.io
Apache License 2.0
517 stars 531 forks source link

Inconsistent directory permissions in bazel cache: user has no permissions to delete generated files #2053

Open miklelappo opened 1 month ago

miklelappo commented 1 month ago

🐞 bug report

Affected Rule

I guess bootstrap python

ls -la ~/.cache/bazel/_bazel_mlappo/3c5c24edab0df70f75e12e6adf52c6d8/external/rules_python\~\~python\~python_3_11_x86_64-unknown-linux-gnu    
total 72
drwxr-xr-x   6 mlappo mlappo  4096 Jul  8 21:34 .
drwxr-xr-x 143 mlappo mlappo 36864 Jul 10 09:09 ..
drwxr-xr-x   2 mlappo mlappo  4096 Jul  8 21:34 bin
-rwxr-xr-x   1 mlappo mlappo  2752 Jul  8 21:34 BUILD.bazel
drwxr-xr-x   3 mlappo mlappo  4096 Jul  8 21:34 include
dr-xr-xr-x  10 mlappo mlappo  4096 Jul  8 21:34 lib
lrwxrwxrwx   1 mlappo mlappo   151 Jul  8 21:34 python -> /home/mlappo/.cache/bazel/_bazel_mlappo/3c5c24edab0df70f75e12e6adf52c6d8/external/rules_python~~python~python_3_11_x86_64-unknown-linux-gnu/bin/python3
-rw-r--r--   1 mlappo mlappo     0 Jul  8 21:34 REPO.bazel
drwxr-xr-x   3 mlappo mlappo  4096 Jul  8 21:34 share
-rwxr-xr-x   1 mlappo mlappo   100 Jul  8 21:34 STANDALONE_INTERPRETER
-rw-r--r--   1 mlappo mlappo     0 Jul  8 21:34 WORKSPACE

dr-xr-xr-x 10 mlappo mlappo 4096 Jul 8 21:34 lib

Is this a regression?

Don't know

Description

Specified directory and shared object are marked as read-only for current user (user performed the build)

πŸ”¬ Minimal Reproduction

bazel build //... with having i.e. wheel creation

🌍 Your Environment

Operating System:

  
uname -a
Linux mlappo-mobl 6.9.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 05 Jul 2024 22:11:24 +0000 x86_64 GNU/Linux
  

Output of bazel version:

  
bazel version
Bazelisk version: v1.11.0
WARNING: Ignoring JAVA_HOME, because it must point to a JDK, not a JRE.
Starting local Bazel server and connecting to it...
Build label: 7.2.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Jun 10 13:04:32 2024 (1718024672)
Build timestamp: 1718024672
Build timestamp as int: 1718024672
  

Rules_python version:

  
0.33.2
  

Anything else relevant?

miklelappo commented 1 month ago

Also the files inside. This one looks correct:

ls -la ~/.cache/bazel/_bazel_mlappo/3c5c24edab0df70f75e12e6adf52c6d8/external/rules_python\~\~python\~python_3_11_x86_64-unknown-linux-gnu/bin/python3.11 
-rwxrwxr-x 1 mlappo mlappo 20944 Jan  1  2024 /home/mlappo/.cache/bazel/_bazel_mlappo/3c5c24edab0df70f75e12e6adf52c6d8/external/rules_python~~python~python_3_11_x86_64-unknown-linux-gnu/bin/python3.11

While this one doesn't

ls -la ~/.cache/bazel/_bazel_mlappo/3c5c24edab0df70f75e12e6adf52c6d8/external/rules_python\~\~python\~python_3_11_x86_64-unknown-linux-gnu/lib/libpython3.so 
-r-xr-xr-x 1 mlappo mlappo 16800 Jan  1  2024 /home/mlappo/.cache/bazel/_bazel_mlappo/3c5c24edab0df70f75e12e6adf52c6d8/external/rules_python~~python~python_3_11_x86_64-unknown-linux-gnu/lib/libpython3.so
aignas commented 1 month ago

This is a feature and is currently discussed in #2016 and the associated issue.

miklelappo commented 1 month ago

@aignas does that mean that read-only-executable permissions only on some files/folders are expected?