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

clean command errors if Starlark-defined flags are provided #11506

Closed
Yannic opened this issue May 27, 2020 · 3 comments
Closed

clean command errors if Starlark-defined flags are provided #11506

Yannic opened this issue May 27, 2020 · 3 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug

Comments

@Yannic
Copy link
Contributor

Yannic commented May 27, 2020

Description of the problem / feature request:

I have set a Starlark-defined flag in my .bazelrc file:

build --@io_bazel_rules_go//go/config:incompatible_package_conflict_is_error=True

Since bazel clean inherits the command-line flags from build, running bazel clean fails with the following error message:

INFO: Options provided by the client:
  [...]
INFO: Reading rc options for 'clean' from <redacted>/.bazelrc:
  Inherited 'common' options: [...]
INFO: Reading rc options for 'clean' from <redacted>/.bazelrc:
  Inherited 'build' options: --@io_bazel_rules_go//go/config:incompatible_package_conflict_is_error=True  [...]
ERROR: Unrecognized arguments: --@io_bazel_rules_go//go/config:incompatible_package_conflict_is_error=True

It's unclear to me why bazel clean looks at any flags defined for bazel build (AFAICT, clean unconditionally deletes everything, so it probably shouldn't even look at .bazelrc common flags). At the very least, bazel clean should ignore Starlark-defined flags.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

clone https://github.com/bazelbuild/rules_go
run bazel clean --@io_bazel_rules_go//go/config:incompatible_package_conflict_is_error=True

What operating system are you running Bazel on?

macOS

What's the output of bazel info release?

3.1.0 / 3.2.0rc1

@katre
Copy link
Member

katre commented May 27, 2020

@juliexxia, is this fixed by your recent work on InfoCommand, or does that change (I think 2ec58f6) need to be repeated for CleanCommand?

@katre katre added P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug labels May 27, 2020
@Yannic
Copy link
Contributor Author

Yannic commented May 27, 2020

@katre Thanks, I remember seeing that commit some time ago (but didn't remember enough about it to find it again). I also see it with last_green (4d19c0095b791f0c4ccccfaea5f279e373469b24), so it probably needs to be repeated for bazel clean.

@juliexxia
Copy link
Contributor

juliexxia commented May 27, 2020

FWIW, you're totally right about clean not needing build options and this is know technical debt for the bazel team (though not one that is prioritized right now): https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java;l=58?q=CleanCommand&ss=bazel

Hoping I can do a similarly quick fix here as I did for blaze info. I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants