This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit a720448be16de45458a7efd3e615d04ff0bc9daf
Author: Peter Kovacs <[email protected]>
AuthorDate: Sat Jul 25 19:06:16 2026 +0200

    build: fix link-wrapper log collision + missing findstr/ping on PATH
    
    The msvc_link.bat wrapper redirected link.exe output to
    %TEMP%\bzl_link_%RANDOM%%RANDOM%.log.  cmd's %RANDOM% is clock-seeded, so
    link actions launched in the same tick got the SAME log name.  With link
    parallelism enabled, the 7 applauncher EXEs (swriter/scalc/...) link at
    once; two wrappers opened one log path with '>' and the second hit
    ERROR_SHARING_VIOLATION, the redirect failed, link.exe never ran, and Bazel
    reported "output 'scalc.exe' was not created" on an otherwise clean build.
    
    Derive the log name from !ep! (the sanitized per-target @param-file name,
    already computed for the mspdbsrv endpoint), which is unique across
    concurrent targets.
    
    Also put %SystemRoot%\System32 on PATH: the action PATH is only VC\bin, so
    findstr (the LNK1318 retry classifier) and ping (its backoff) were "not
    found", printing errors and disabling the retry logic.
    
    Co-Authored-By: Claude Opus 4.8 <[email protected]>
---
 build/vs_config_repo.bzl | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/build/vs_config_repo.bzl b/build/vs_config_repo.bzl
index 93ff14d308..fe793994e1 100644
--- a/build/vs_config_repo.bzl
+++ b/build/vs_config_repo.bzl
@@ -102,6 +102,10 @@ def _vs_config_impl(rctx):
     bat = "\r\n".join([
         "@echo off",
         "setlocal enabledelayedexpansion",
+        # The action PATH is just VC\\bin; findstr/ping (used below for the 
LNK1318
+        # retry classifier and its backoff) live in System32 — put it on PATH.
+        # Appended, so the VC9 toolchain binaries still take precedence.
+        "set \"PATH=%PATH%;%SystemRoot%\\System32\"",
         "set \"ep=\"",
         "for %%A in (%*) do (",
         "  set \"arg=%%A\"",
@@ -116,7 +120,12 @@ def _vs_config_impl(rctx):
         # Tunables (override via --action_env at build time), with sane 
defaults.
         "if not defined LINK_MAX_RETRY set \"LINK_MAX_RETRY=5\"",
         "if not defined LINK_RETRY_BASE_SEC set \"LINK_RETRY_BASE_SEC=2\"",
-        "set \"log=%TEMP%\\bzl_link_%RANDOM%%RANDOM%.log\"",
+        # Log name MUST be unique per concurrent link.  %RANDOM% is 
clock-seeded, so
+        # links launched in the same tick (e.g. the 7 applauncher EXEs) 
collided on
+        # one log path → the second '>' redirect hit ERROR_SHARING_VIOLATION 
and the
+        # link never ran ("output X was not created").  !ep! is derived from 
the
+        # per-target @param-file name, so it is unique across concurrent 
targets.
+        "set \"log=%TEMP%\\bzl_link_!ep!.log\"",
         "set \"n=0\"",
         ":retry",
         "set /a n+=1",

Reply via email to