Skip to content

[Bug]: Runfiles manifest entries with escapes cause issues with bazel outputs #32

@ewhauser

Description

@ewhauser

What happened?

I'm seeing the following error from aspect outputs:

(19:31:01) [ASPECT] [XTRACE] [RUN] (/mnt/ephemeral/workdir/monorepo/monorepo) /etc/aspect/workflows/bin/h2o --root-start-time 1737401430 --trace-id e1ee01275a2ee972a7656e39948c46d3 --span-id adda15fd87db3b50 --profile /mnt/ephemeral/output/monorepo/__main__/delivery_manifest.profile.gz
(19:31:01) [ASPECT] [XTRACE] [EXEC] (.) bazel --nohome_rc --bazelrc=.aspect/workflows/bazelrc --bazelrc=.bazelrc --output_user_root=/mnt/ephemeral/bazel/monorepo/__main__ --output_base=/mnt/ephemeral/output/monorepo/__main__ outputs --aspect:lock_version --profile=/mnt/ephemeral/output/monorepo/__main__/delivery_manifest.profile.gz --query_file=/tmp/rosetta-qdmSgR/delivery_manifest.outputs.txt --announce_rc ExecutableHash
(19:31:02) [ASPECT] [XTRACE] [RUN] (/mnt/ephemeral/workdir/monorepo/monorepo) /etc/aspect/workflows/bin/h2o --root-start-time 1737401461 --trace-id e1ee01275a2ee972a7656e39948c46d3 --span-id 410c11101f1fb088 --profile /mnt/ephemeral/output/monorepo/__main__/delivery_manifest.profile.gz
╭─
 Error: 
  x Failed to query for deliverable targets
  ├▶ • Error running bazel command: 'bazel outputs (invocation 1c41abcf-f3e8-4072-ae76-c496b24e0ef1)
  ╰▶ • A build or parsing failure occurred.
  
  ╭[exit code: 1]
  │
  ├[stdout]
  · 
  ·
  ├[stderr]
  · Error: failed to stat runfiles manifest entry rules_python~~python~python_3_11_4_x86_64-unknown-linux-gnu/lib/python3.11/site-packages/setuptools/command/launcher\smanifest.xml: stat rules_python~~python~python_3_11_4_x86_64-unknown-linux-gnu/lib/python3.11/site-packages/setuptools/command/launcher\smanifest.xml: no such file or directory


  ╰
╰─

If I remove that file via a patch, I get an error on the next file that has a space in it. Runfiles entries can be escaped - here is the relevant C++ code:

https://github.com/bazelbuild/bazel/blob/master/src/main/tools/build-runfiles.cc#L107

These names need be unescaped prior to trying to hash the file entry.

Version

Development (host) and target OS/architectures:

Output of bazel --version:

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

Any other information?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions