Use long executable path instead of argv[0] in all launchers#16916
Use long executable path instead of argv[0] in all launchers#16916fmeum wants to merge 3 commits intobazelbuild:masterfrom
argv[0] in all launchers#16916Conversation
`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 |
meteorcloudy
left a comment
There was a problem hiding this comment.
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 <fabian@meumertzhe.im>
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.