Skip to content

Reproduce bug in clippy-driver #2444

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

Closed

Conversation

daivinhtran
Copy link
Contributor

@daivinhtran daivinhtran commented Jan 24, 2024

Steps to reproduce #2418

  1. https://github.com/dmeister/rules_rules_clippy_repo and replace http_archive(name = "rules_rust") to local_repository pointing to a local repo of rules_rust
  2. In rules_rust repo, apply the patch https://github.com/bazelbuild/rules_rust/pull/2444.diff
  3. Flip the counter back and forth between 22 and 23 to reproduce the bug

I believe when there are too many arguments to clippy-driver, it breaks.

@daivinhtran daivinhtran force-pushed the reproduce-clippy-driver-bug branch from fefc64f to ad59a10 Compare January 24, 2024 20:14
@daivinhtran daivinhtran force-pushed the reproduce-clippy-driver-bug branch from ad59a10 to 06529e2 Compare January 24, 2024 20:20
@daivinhtran
Copy link
Contributor Author

daivinhtran commented Jan 24, 2024

Intererestingly //crate_universe:cargo_bazel_bin has similar setup but clippy-driver doesn't fail on it.

@UebelAndre
Copy link
Collaborator

So the complaint about duplicate --sysroot is a red herring?

@daivinhtran
Copy link
Contributor Author

daivinhtran commented Jan 25, 2024

So the complaint about duplicate --sysroot is a red herring?

I believe so. Have you seen #2447?

process_wrapper parses (and processes?) the args and pass "@bazel-out/k8-fastbuild/bin/hello_world/hello_world.clippy.ok-0.params.expanded", "-Lnative=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/external/crate_index__ring-0.16.20/ring_build_script.out_dir", "-Lnative=/tmp/bazel-working-directory/_main/bazel-out/k8-fastbuild/bin/external/crate_index__ring-0.17.7/ring_build_script.out_dir" to clippy-driver.

clippy-driver then sets --syroot based on SYSROOT.

I believe, at runtime within the execution of the process_wrapper, clippy-driver sees another --sysroot in the .expanded file and fails. That's why either removing "--sysroot" (which causes it to be removed from .expanded) or removing SYSROOT (which causes --sysroot not to be created by clippy-driver before calling rustc) fixed the error; but it's not the true fix. The true fix should be fixing process_wrapper to not wrap --sysroot into @bazel-out/k8-fastbuild/bin/hello_world/hello_world.clippy.ok-0.params.expanded or make @bazel-out/k8-fastbuild/bin/hello_world/hello_world.clippy.ok-0.params.expanded more deterministic.

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