-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Bazel fails to start if username contains accented characters on Windows #18293
Description
Description of the bug:
All Bazel Windows executables fail during startup if the path to the user's home directory contains accented characters. The accented character in most cases comes from the username. Crashes occur either because Bazel can't create necessary files and folders, or because it can't load certain dynamic libraries because the accent is mishandled in the path.
Bazelisk is also affected.
Changing the default code page on Windows to use utf-8 fixes some of the early start-up crashes, but Bazel will eventually mishandle a path and fail. This can be done by going to the system's Language settings, selecting Administrative language settings, clicking Change system locale... and checking the Beta: Use Unicode UTF-8 for worldwide language support box and then restarting the system.
I tested this with the 7.0.0 prerelease build as well. This version also fails. However, some improvements have been made in this version of Bazel. With the code page change described above Bazel will finish launching, however, it still emits an error. See output section at the end of this document
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
- Create a new user with an accented character in their username ("István" in my case).
- Download the latest version of Bazel (6.1.2 as of writing).
- Invoke the downloaded binary.
- Bazel will crash during startup. Error message says it wasn't able to create it's directories due to malformed path.
Which operating system are you running Bazel on?
Windows 10/11
What is the output of bazel info release?
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file). Error occurred during initialization of VM Unable to load native library:
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
Have you found anything relevant by searching the web?
Similar previous issue #3821
Any other information, logs, or outputs that you want to share?
Example invocations with errors:
C:\Users\István\Downloads>.\bazel-6.1.2-windows-x86_64.exe
FATAL: MakeDirectories(C:\Users\Istv�n\_bazel_Istv�n) failed: (error: 5): Access is denied.
C:\Users\István\Downloads>.\bazel-7.0.0-pre.20230420.2-windows-x86_64.exe
FATAL: MakeDirectories(C:\Users\Istv�n\_bazel_Istv�n) failed: (error: 5): Access is denied.
Example invocations running from an elevated prompt. This will create the incorrect paths from above, and will reveal other ways in which the path is mishandled.
C:\Users\István\Downloads>.\bazel-6.1.2-windows-x86_64.exe
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file).
Error: Unable to access jarfile C:\\Users\\Istv?n\\_bazel_Istv?n\\install\\e76193b64e56978bde876acece865a29\\A-server.jar
Invocations with experimental utf-8 support turned on. See bug description
C:\Users\István\Downloads>bazel-7.0.0-pre.20230420.2-windows-x86_64.exe
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file).
Extracting Bazel installation...
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
java.util.logging.ErrorManager: 4: Failed to open log file
java.io.FileNotFoundException: c:\users\istván\_bazel_istván\u5mzpase\java.log.windev2303eval.István.log.java.20230503-035546.5940 (The system cannot find the path specified)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(Unknown Source)
at java.base/java.io.FileOutputStream.<init>(Unknown Source)
at com.google.devtools.build.lib.util.SimpleLogHandler$Output.open(SimpleLogHandler.java:741)
at com.google.devtools.build.lib.util.SimpleLogHandler.openOutputIfNeeded(SimpleLogHandler.java:828)
at com.google.devtools.build.lib.util.SimpleLogHandler.publish(SimpleLogHandler.java:433)
at java.logging/java.util.logging.Logger.log(Unknown Source)
at com.google.common.flogger.backend.system.AbstractBackend.log(AbstractBackend.java:76)
at com.google.common.flogger.backend.system.SimpleLoggerBackend.log(SimpleLoggerBackend.java:31)
at com.google.common.flogger.AbstractLogger.write(AbstractLogger.java:137)
at com.google.common.flogger.LogContext.logImpl(LogContext.java:566)
at com.google.common.flogger.LogContext.log(LogContext.java:686)
at com.google.devtools.build.lib.analysis.BlazeVersionInfo.logVersionInfo(BlazeVersionInfo.java:65)
at com.google.devtools.build.lib.analysis.BlazeVersionInfo.setBuildInfo(BlazeVersionInfo.java:80)
at com.google.devtools.build.lib.bazel.Bazel.main(Bazel.java:94)
[bazel release 7.0.0-pre.20230420.2]
C:\Users\István\Downloads>bazel-6.1.2-windows-x86_64.exe
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file).
Error occurred during initialization of VM
Unable to load native library: