-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Use long executable path instead of argv[0]
in all launchers
#16916
Conversation
`argv[0]` can differ from the path of the launcher executable and can contain 8.3 style filenames, which need to be resolved to long paths before path manipulation (e.g. appending ".runfiles") can succeed. The Python launcher handled this correctly, but other launchers didn't use the long executable path consistently and thus spuriously failed when Bazel emitted an 8.3 path.
7f80ff5
to
70e60d9
Compare
@meteorcloudy Could you review this bug fix? I hit in a real world scenario with a Java tool that ended up falling back to the non-existent runfiles directory as it couldn't find the manifest. The error caused by that is indeed very confusing. I will flag this for cherry-picking into some Bazel 6 release. |
@bazel-io flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! Maybe we should add a simple test case in https://github.com/bazelbuild/bazel/blob/master/src/test/py/bazel/launcher_test.py#L615?
@fmeum Since this is not a new regression in Bazel 6.0, I prefer to cherry pick it into 6.1 to not delay the release of 6.0 (tomorrow), WDYT? |
Sounds good! |
@meteorcloudy I added tests. In fact, I added one for invalid |
Ah, thanks! That explains why we didn't catch this bug before. |
@bazel-io fork 6.1.0 |
`argv[0]` can differ from the path of the launcher executable. The latter can contain 8.3 style filenames, which need to be resolved to long paths before path manipulation (e.g. appending ".runfiles") can succeed. The Python launcher handled this correctly, but other launchers didn't use the long executable path consistently. Closes #16916. PiperOrigin-RevId: 493615543 Change-Id: Ic8161890181c0110ecdf6893b9835e6f99d01097 Co-authored-by: Fabian Meumertzheim <[email protected]>
argv[0]
can differ from the path of the launcher executable. The latter can contain 8.3 style filenames, which need to be resolved to long paths before path manipulation (e.g. appending ".runfiles") can succeed.The Python launcher handled this correctly, but other launchers didn't use the long executable path consistently.