Skip to content

Conversation

@jaqx0r
Copy link

@jaqx0r jaqx0r commented Dec 19, 2025

Running :cwd in a genrule doesn't find the tool -- it reports a file not found error.

This doesn't work for me -- this test is a reproduction of the `:cwd`
target for a multitool not finding the `tool`.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

name = "run_gh_alias_import",
srcs = ["test_gh_aliases.yaml"],
outs = ["run_gh_alias_import.out"],
cmd = "$(location @multitool//tools/gh:cwd) alias import test_gh_aliases.yaml && touch run_gh_alias_import.out",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reference genrule input via $(location)

Building //examples/module:run_gh_alias_import runs gh alias import test_gh_aliases.yaml without a $(location ...) expansion, but genrule commands execute from the output directory and do not stage source files there. In sandboxed or remote builds the YAML won’t be found, so the new build_test will fail every time. Use $(location test_gh_aliases.yaml) (or $(SRCS)) so the command can see its input file.

Useful? React with 👍 / 👎.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thi s is intentional because I want the :cwd to find the file in the working directory, simulating a tool that expects a config file in the cwd.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure I understand the issue you’re trying to test — :cwd doesn’t work for you, or config files in the current working directory are not available to you when running using bazel run?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:cwd doesn't work -- the wrapper script gets a file not found error trying to execute the tool when in a genrule or run_binary context.

I expected to be able to use :cwd to say "run the command in the current path, because this program has weird behaviour that expects its config file to exist in the location it's run in."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants