hedronvision / bazel-compile-commands-extractor

Goal: Enable awesome tooling for Bazel users of the C language family.
Other
659 stars 109 forks source link

The current user is root, please run as non-root when using the hermetic Python interpreter #166

Closed 372046933 closed 7 months ago

372046933 commented 7 months ago

https://github.com/hedronvision/bazel-compile-commands-extractor/blob/c4918fabf92f9b8176e6475e5abc611f75e63d70/workspace_setup_transitive.bzl#L31-L35 Possible fix

ignore_root_user_error = True,
cpsauer commented 7 months ago

Hey @372046933, seems from the caveats about that flag in their docs (and it being undocumented for python_register_toolchains as opposed to bzlmod) that we should be careful with this one, doubly because they say it's ignored outside the root module, which this will almost never be.

Any chance I could ask you to give me a little more context? Is this in a container or CI or something where everything's running as root?

More generally, we're seeing enough problems/bugs with bazel's rules_python that we might revert back to builtin python for now. Would you be down to report the underlying issue to https://github.com/bazelbuild/rules_python, so they know what would be good to support here, or chime in on https://github.com/bazelbuild/rules_python/issues/1169 if that seems better? And then, as a workaround, please make sure that all works fine with https://github.com/hedronvision/bazel-compile-commands-extractor/commit/6d58fa6bf39f612304e55566fa628fd160b38177, the commit before we switched to rules_python? (While using that one as a workaround, go ahead and delete all our transitive workspace setup calls from your WORKSPACE.)

372046933 commented 7 months ago

@cpsauer I was in a container where everything is running as root. All works fine before rules_python. ignore_root_user_error was used in TF https://github.com/tensorflow/tensorflow/blob/63024e99dd0d8d40bb679678c2d7c8a611722a96/WORKSPACE#L36-L40

cpsauer commented 7 months ago

Yeah, no I get it--and really appreciate your writing in to write in to report with a proposed fix no less. That said, I think the move here is for us to roll back the move to rules_python. We're just seeing a lot of brokenness there, this included, and there are some strong caveats there (like that we can't fix this with bzlmod)

cpsauer commented 7 months ago

Reverted rules_python in https://github.com/hedronvision/bazel-compile-commands-extractor/commit/0b821b7e4286aec887757461366f6eaaa0972cb9. Tracking restoration in https://github.com/hedronvision/bazel-compile-commands-extractor/issues/168.

That avoids this for now, but seriously, worth chiming in on https://github.com/bazelbuild/rules_python/issues/1169 so they fix it for future use. (Just holler if you want me to reopen.)

Thanks again for helping leave things better than you found them!