bazelbuild/bazel

Windows: cannot shorten the path enough

已关闭

#19,710 创建于 2023年10月3日

 (1 条评论) (6 个反应) (0 位负责人)Java (4,465 个派生)batch import
P2area-Windowshelp wantedteam-OSStype: bug

仓库指标

星标
 (25,384 个星标)
PR 合并指标
 (平均合并 22天 20小时) (30 天内合并 77 个 PR)

描述

Description of the bug:

When running tests on windows with --windows_enable_symlinks and --enable_runfiles, the test would fail with

==================== Test output for //enterprise/server/remote_execution/commandutil:commandutil_test:
ERROR(tools/test/windows/tw.cc:1297) 
ERROR: src/main/native/windows/process.cc(95): WaitableProcess::Create(D:\0\ihlv26j4\execroot\buildbuddy\bazel-out\x64_windows-fastbuild\bin\enterprise\server\remote_execution\commandutil\commandutil_test_\commandutil_test.exe.runfiles\buildbuddy\enterprise\server\remote_execution\commandutil\commandutil_test_\commandutil_test.exe): 
ERROR: src/main/native/windows/util.cc(292): AsExecutablePathForCreateProcess(D:\0\ihlv26j4\execroot\buildbuddy\bazel-out\x64_windows-fastbuild\bin\enterprise\server\remote_execution\commandutil\commandutil_test_\commandutil_test.exe.runfiles\buildbuddy\enterprise\server\remote_execution\commandutil\commandutil_test_\commandutil_test.exe): 
ERROR: src/main/native/windows/util.cc(262): GetShortPathNameW(\\?\D:\0\ihlv26j4\execroot\buildbuddy\bazel-out\x64_windows-fastbuild\bin\enterprise\server\remote_execution\commandutil\commandutil_test_\commandutil_test.exe.runfiles\buildbuddy\enterprise\server\remote_execution\commandutil\commandutil_test_\commandutil_test.exe): cannot shorten the path enough

ERROR(tools/test/windows/tw.cc:1456) Failed to start test process (arg: D:\0\ihlv26j4\execroot\buildbuddy\bazel-out\x64_windows-fastbuild\bin\enterprise\server\remote_execution\commandutil\commandutil_test_\commandutil_test.exe.runfiles\buildbuddy\enterprise\server\remote_execution\commandutil\commandutil_test_\commandutil_test.exe)
================================================================================

(reformatted log to multiple lines for readability)

This is not expected as the Windows instance has been configured with Long Paths support

Which category does this issue belong to?

Core, Local Execution

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Perform any test on Windows with a sufficient long package path.

Which operating system are you running Bazel on?

Windows

What is the output of bazel info release?

release 6.4.0rc1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

N/A

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

N/A

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getshortpathnamew

Starting with Windows 10, Version 1607, you can opt-in to remove the MAX_PATH limitation without prepending "\?". See the "Maximum Path Length Limitation" section of Naming Files, Paths, and Namespaces for details.

So ideally, we should just migrate Windows syscalls to the new behavior.

贡献者指南