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

./pants --changed-since=<ref> filter crashes when a target points at a file with @ in its name #15217

Closed
danxmoran opened this issue Apr 21, 2022 · 2 comments · Fixed by #15226
Labels
Milestone

Comments

@danxmoran
Copy link
Contributor

danxmoran commented Apr 21, 2022

Describe the bug

Background

(Minimized/generalized)

Our Django apps typically contain a static/ folder containing images etc for use in templates. The folder is structured like:

static/
    BUILD.pants
    ...
    images/
        ....
        img1_80x80@2x.png

Since there are many sub-folders under static/ and none of them are code, we've been lazy and putting:

resources(sources=["**/*"])

In static/BUILD.pants. Our templates / views can then depend on ./static and pull in everything.

Problem

In this setup, if I run ./pants --changed-since=master filter, the process crashes with:

17:37:34.92 [ERROR] Failed to parse Address `src/django_apps/core/static/images/site/cancer_80x80@2x.png:../../static`: error at 1:54: expected one or more key=value pairs to follow a `@`.
Traceback (most recent call last):
  File "/Users/dan.moran/.cache/pants/setup/bootstrap-Darwin-x86_64/pants.3nnXTF/install/lib/python3.9/site-packages/pants/bin/daemon_pants_runner.py", line 131, in single_daemonized_run
    runner = LocalPantsRunner.create(
  File "/Users/dan.moran/.cache/pants/setup/bootstrap-Darwin-x86_64/pants.3nnXTF/install/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 156, in create
    specs = calculate_specs(
  File "/Users/dan.moran/.cache/pants/setup/bootstrap-Darwin-x86_64/pants.3nnXTF/install/lib/python3.9/site-packages/pants/init/specs_calculator.py", line 71, in calculate_specs
    address_input = AddressInput.parse(address.spec)
  File "/Users/dan.moran/.cache/pants/setup/bootstrap-Darwin-x86_64/pants.3nnXTF/install/lib/python3.9/site-packages/pants/build_graph/address.py", line 141, in parse
    ) = native_engine.address_parse(spec)
native_engine.AddressParseException: Failed to parse Address `src/django_apps/core/static/images/img1_80x80@2x.png:../static`: error at 1:54: expected one or more key=value pairs to follow a `@`.

Pants version
v2.10.0

OS
Both MacOS and Linux

Additional info

  • ./pants filter :: doesn't crash in the same way
  • ./pants filter --target-type=resource :: doesn't crash, and it successfully includes static/images/img1_80x80@2x.png in the output. So the @ symbol doesn't always make things crash.
@danxmoran danxmoran added the bug label Apr 21, 2022
@stuhood stuhood added this to the 2.10.x milestone Apr 21, 2022
@stuhood
Copy link
Sponsor Member

stuhood commented Apr 21, 2022

Oof: sorry for the trouble. We'll get a fix cherry-picked for this.

This was referenced Apr 21, 2022
stuhood added a commit that referenced this issue Apr 22, 2022
Fix use of `@` in path names as long as they are not followed by parameter syntax.

Fixes #15217.
stuhood added a commit to stuhood/pants that referenced this issue Apr 22, 2022
Fix use of `@` in path names as long as they are not followed by parameter syntax.

Fixes pantsbuild#15217.
# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
stuhood added a commit to stuhood/pants that referenced this issue Apr 22, 2022
Fix use of `@` in path names as long as they are not followed by parameter syntax.

Fixes pantsbuild#15217.

[ci skip-build-wheels]
stuhood added a commit that referenced this issue Apr 22, 2022
Fix use of `@` in path names as long as they are not followed by parameter syntax.

Fixes #15217.

[ci skip-build-wheels]
stuhood added a commit that referenced this issue Apr 22, 2022
Fix use of `@` in path names as long as they are not followed by parameter syntax.

Fixes #15217.

[ci skip-build-wheels]
@stuhood
Copy link
Sponsor Member

stuhood commented May 2, 2022

@danxmoran : The fix for this one is released in 2.10.1rc1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants