Misleading error message on rule producing TreeArtifact with dangling links #22068
Labels
team-Rules-API
API for writing rules/aspects: providers, runfiles, actions, artifacts
type: bug
untriaged
Description of the bug:
When a rule writes into a declare_directory and the written files including dangling symlinks, the following error is produced:
ERROR: /.../repo/BUILD.bazel:182:15: TreeArtifact src/container_images/repo/python4 was not created ERROR: /.../repo/BUILD.bazel:182:15: Extracting from external/python_tar_gz/file/downloaded to bazel-out/k8-opt/bin/.../repo/python4... failed: not all outputs were created or valid
This is misleading (it stumped me for 24 hours) because there clearly is content in that output folder.
The rule might be run by an extract task that is extracting a tar file into a directory - so the content might not be immediately familiar to the build engineer - it would be much more helpful if it said "dangling symlink found, invalid TreeArtifact content rejected" or somesuch.
Which category does this issue belong to?
Rules API
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Extract a tar file containing a dangling symlink with aspect rules_binary
Which operating system are you running Bazel on?
ubuntu
What is the output of
bazel info release
?release 7.1.1
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 HEAD
?No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No response
Have you found anything relevant by searching the web?
No
Any other information, logs, or outputs that you want to share?
bazel build //src/.../repo:extract_python -s
INFO: Invocation ID: e63770c3-016e-4597-9fca-16b9bc0f3fb2
INFO: Analyzed target //src/.../repo:extract_python (1 packages loaded, 3 targets configured).
SUBCOMMAND: # //src/.../repo:extract_python [action 'Extracting from external/python_tar_gz/file/downloaded to bazel-out/k8-opt/bin/src/.../repo/python4...', configuration: 61c861bbaa36efb2afa2cc798451e8fe0f84c14c81358840106b67dc10be5ba2, execution platform: @@tc_toolchain//platforms:x64_linux, mnemonic: TARExtract]
(cd /root/.cache/bazel/_bazel_root/188506c7b02e36f1e557ada8df8c1e08/execroot/_main &&
exec env -
BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
JAVA_HOME=../bazel_tools/jdk
bazel-out/k8-opt-exec-ST-92d7732a2b63/bin/src/.../repo/tar --same-permissions -zxf external/python_tar_gz/file/downloaded -C bazel-out/k8-opt/bin/src/.../repo/python4 bin)
Configuration: 61c861bbaa36efb2afa2cc798451e8fe0f84c14c81358840106b67dc10be5ba2
Execution platform: @@tc_toolchain//platforms:x64_linux
ERROR: /.../repo/BUILD.bazel:182:15: TreeArtifact src/container_images/repo/python4 was not created
ERROR: /apps/browchri/tc2406/src/container_images/repo/BUILD.bazel:182:15: Extracting from external/python_tar_gz/file/downloaded to bazel-out/k8-opt/bin/src/.../repo/python4... failed: not all outputs were created or valid
Target //src/.../repo:extract_python failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.591s, Critical Path: 1.45s
INFO: 2 processes: 1 internal, 1 processwrapper-sandbox.
ERROR: Build did NOT complete successfully
ls -l bazel-out/k8-opt/bin/src/.../repo/python4
total 4
dr-xr-xr-x 2 root root 4096 Apr 21 21:15 bin
ls -l bazel-out/k8-opt/bin/src/.../repo/python4/bin
total 22916
lrwxrwxrwx 1 root root 9 Apr 20 20:38 2to3 -> 2to3-3.10
lrwxrwxrwx 1 root root 8 Apr 20 20:38 idle3 -> idle3.10
lrwxrwxrwx 1 root root 9 Apr 20 20:38 pydoc3 -> pydoc3.10
lrwxrwxrwx 1 root root 10 Apr 20 20:38 python3 -> python3.10
lrwxrwxrwx 1 root root 17 Apr 20 20:38 python3-config -> python3.10-config
-r-xr-xr-x 1 root root 23458520 Apr 20 20:38 python3.10
-r-xr-xr-x 1 root root 3085 Apr 20 20:38 python3.10-config
`
The text was updated successfully, but these errors were encountered: