pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.33k stars 637 forks source link

system_binary not finding binary in path #20654

Closed jasonwbarnett closed 8 months ago

jasonwbarnett commented 8 months ago

Describe the bug

I have this BUILD file

system_binary(
    name="pulumi",
    binary_name="pulumi",
    fingerprint=r"^v3\.",
    fingerprint_args=["version"],
)
$ pants package apps/app1:docker
22:05:53.95 [ERROR] 1 Exception encountered:

Engine traceback:
  in `package` goal

ValueError: Could not find a binary with name `pulumi` with output matching `^v3\.` when run with arguments `version`. The following paths were searched: /usr/bin, /bin, /usr/local/bin, /opt/homebrew/bin.
$ /usr/local/bin/pulumi version
v3.108.1

After adding /usr/local/bin to extra_search_paths it works

system_binary(
    name="pulumi",
    binary_name="pulumi",
    extra_search_paths=["/usr/local/bin"],
    fingerprint=r"^v3\.",
    fingerprint_args=["version"],
)

I would expect either the error message not to mention /usr/local/bin being in the search path (if not being used) or to properly use the search path.

Pants version 2.19

OS Mac OS and Linux

huonw commented 8 months ago

https://github.com/pantsbuild/pants/issues/19013 is tangentially related (both about this search and error message), although that's notably different.

benjyw commented 8 months ago

How did /usr/local/bin/pulumi get there? Was it brew-installed on MacOS? Just verifying that this happens on MacOS and on Linux, as you state?

benjyw commented 8 months ago

I can't reproduce this on my M1 so far.

jasonwbarnett commented 8 months ago

It turns out that after running clean -fdx . and rm -rf ~/.cache/pants it "just worked."

benjyw commented 8 months ago

@jasonwbarnett is this reopened on purpose?