)]}'
{
  "commit": "313773c665866583223f6f59148d373d405edc82",
  "tree": "852f2fff360337babd9c225b09a845ddaff4c498",
  "parents": [
    "6dfb9f5f7256023344ac32f665067765431af021"
  ],
  "author": {
    "name": "bazel.build machine account",
    "email": "ci.bazel@gmail.com",
    "time": "Thu Jun 25 22:11:24 2026 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Jun 25 20:11:24 2026 +0000"
  },
  "message": "[9.2.0] Fix launching executables whose path can\u0027t be shortened on Windows (https://github.com/bazelbuild/bazel/pull/29921) (#29984)\n\n### Description\n`AsExecutablePathForCreateProcess` shortens an executable\u0027s path with\n`GetShortPathNameW` so it fits `CreateProcessW`\u0027s `MAX_PATH`-bound\ncommand line, and currently fails outright when shortening can\u0027t bring\nit under `MAX_PATH`.\nThis change adds a fallback: it launches the executable through\n`CreateProcessW`\u0027s _lpApplicationName_, which is not subject to the\n`MAX_PATH` limit, in extended-length (`\\\\?\\`) form.\nSupplying _lpApplicationName_ also lifts the `MAX_PATH` limit from the\nexecutable part of _lpCommandLine_, so the original path is kept there\nas `argv[0]`.\n\nShortening is still attempted first, so the change is a pure superset of\nthe current behavior: paths that shorten today are launched unchanged,\nand only the currently-failing ones take the fallback.\nThe fallback is limited to absolute, normalized paths to plain\nexecutables:\n- a batch file is not a valid _lpApplicationName_ as it must be run\nthrough a command interpreter,\n- neither is a non-normalized path because its `.`/`..` components would\nsurvive unresolved in the extended-length path.\n\nThe fix relies on `\\\\?\\` bypassing `MAX_PATH` at the path-parsing layer,\n**independently** of the _LongPathsEnabled_ registry value and the\n_longPathAware_ manifest.\n\n### Motivation\nFixes #19710.\n\nAvoid errors like:\n```\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d Test output for //some/configuration/issues/invalidconfig:invalidconfig_test:\nERROR(tools/test/windows/tw.cc:1307) ERROR: src/main/native/windows/process.cc(82): WaitableProcess::Create(C:\\user\\execroot\\_main\\bazel-out\\x64_windows-fastbuild-ST-000000000001\\bin\\some\\configuration\\issues\\invalidconfig\\invalidconfig_test_\\invalidconfig_test.exe.runfiles\\_main\\some\\configuration\\issues\\invalidconfig\\invalidconfig_test_\\invalidconfig_test.exe): ERROR: src/main/native/windows/util.cc(292): AsExecutablePathForCreateProcess(C:\\user\\execroot\\_main\\bazel-out\\x64_windows-fastbuild-ST-000000000001\\bin\\some\\configuration\\issues\\invalidconfig\\invalidconfig_test_\\invalidconfig_test.exe.runfiles\\_main\\some\\configuration\\issues\\invalidconfig\\invalidconfig_test_\\invalidconfig_test.exe): ERROR: src/main/native/windows/util.cc(262): GetShortPathNameW(\\\\?\\C:\\user\\execroot\\_main\\bazel-out\\x64_windows-fastbuild-ST-000000000001\\bin\\some\\configuration\\issues\\invalidconfig\\invalidconfig_test_\\invalidconfig_test.exe.runfiles\\_main\\some\\configuration\\issues\\invalidconfig\\invalidconfig_test_\\invalidconfig_test.exe): cannot shorten the path enough\nERROR(tools/test/windows/tw.cc:1517) Failed to start test process (arg: C:\\user\\execroot\\_main\\bazel-out\\x64_windows-fastbuild-ST-000000000001\\bin\\some\\configuration\\issues\\invalidconfig\\invalidconfig_test_\\invalidconfig_test.exe.runfiles\\_main\\some\\configuration\\issues\\invalidconfig\\invalidconfig_test_\\invalidconfig_test.exe)\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n```\n\nShortening fails in two situations, both handled here:\n- 8dot3 short-name creation is disabled on the volume (common in\ncontainers, microsoft/Windows-Containers#507), so `GetShortPathNameW` is\na no-op and a long runfiles executable path stays over `MAX_PATH`,\n- the path is nested so deeply that even fully 8dot3-shortened it still\noverflows `MAX_PATH`.\n\nPrior art: Rust\u0027s `std::process::Command` passes a verbatim `\\\\?\\` path\nas _lpApplicationName_ for a \u003e`MAX_PATH` executable and special-cases\nbatch files the same way:\n- rust-lang/rust#87704,\n- rust-lang/rust#92519.\n\n### Build API Changes\nNo\n\n### Checklist\n- [x] I have added tests for the new use cases (if any).\n- [ ] I have updated the documentation (if applicable).\n\n### Release Notes\nRELNOTES: Fixed Bazel being unable to run a Windows executable whose\npath is too long to shorten under `MAX_PATH`, e.g. when 8dot3 short\nnames are disabled (microsoft/Windows-Containers#507).\n\nCloses #29921.\n\nPiperOrigin-RevId: 937426905\nChange-Id: Ia48d41e000622fc122d1b258ad15daa5018be75e\n\nCommit\nhttps://github.com/bazelbuild/bazel/commit/4a80d43e1640d8d1eedcef4a733be3d1b13be6c7\n\nCo-authored-by: Rgis Desgroppes \u003crdesgroppes@gmail.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "4646a657ce98e51ee3821c605767aa18da9a2899",
      "old_mode": 33188,
      "old_path": "src/main/native/windows/process.cc",
      "new_id": "c8f0a698bb02ef2ac54c9aa68dba8f20c46d4105",
      "new_mode": 33188,
      "new_path": "src/main/native/windows/process.cc"
    },
    {
      "type": "modify",
      "old_id": "615d09951c6993f37d91e5a7d6bca87fdeabb267",
      "old_mode": 33188,
      "old_path": "src/main/native/windows/util.cc",
      "new_id": "872fb10e0e0acf3276cb9a848f7ce8b27d134923",
      "new_mode": 33188,
      "new_path": "src/main/native/windows/util.cc"
    },
    {
      "type": "modify",
      "old_id": "a98e7f8efb9043129d912e89d57a306742c8af1a",
      "old_mode": 33188,
      "old_path": "src/main/native/windows/util.h",
      "new_id": "1a107fd5ecbeba76c3748cadd61657079f66b635",
      "new_mode": 33188,
      "new_path": "src/main/native/windows/util.h"
    },
    {
      "type": "modify",
      "old_id": "f01c236c043d1557b085e70f363327b979d0a4e1",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/windows/WindowsProcessesTest.java",
      "new_id": "a28ad58e90dc183b458964d2c739c659420319c7",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/windows/WindowsProcessesTest.java"
    },
    {
      "type": "modify",
      "old_id": "2d4cd543ffedf02ca105cfd85a3112403a9c06da",
      "old_mode": 33188,
      "old_path": "src/test/native/windows/util_test.cc",
      "new_id": "09cbde19ba65b81bd0de496734914660937439d7",
      "new_mode": 33188,
      "new_path": "src/test/native/windows/util_test.cc"
    }
  ]
}
