Skip to content

Windows: cannot shorten the path enough #19710

Description

@sluongng

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider working on this in future. (Assignee optional)area-WindowsWindows-specific issues and feature requestshelp wantedSomeone outside the Bazel team could own thisteam-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websitetype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions