Skip to content

fix: failpoint-toolexec not working on Windows - #90

Merged
kennytm merged 1 commit into
pingcap:masterfrom
hulucc:fix-windows-toolexec
Apr 6, 2026
Merged

fix: failpoint-toolexec not working on Windows#90
kennytm merged 1 commit into
pingcap:masterfrom
hulucc:fix-windows-toolexec

Conversation

@hulucc

Copy link
Copy Markdown
Contributor

Summary

failpoint-toolexec silently skips all failpoint injection on Windows due to a typo on line 40 of failpoint-toolexec/main.go.

Bug: strings.TrimSuffix(goCmd, ".exe") operates on the full path (C:\...\compile.exeC:\...\compile) instead of the base name. The comparison goCmdBase == "compile" always evaluates to false, so the compile command is never intercepted.

Fix: strings.TrimSuffix(goCmdBase, ".exe")

Reproduction

On Windows, failpoint.Inject markers are never rewritten when using -toolexec failpoint-toolexec. Tests that rely on failpoint injection silently pass without actually injecting errors.

Verified by logging the values inside the toolexec binary:

goCmd = C:\Users\...\compile.exe
Base = compile.exe
orig = C:\Users\...\compile match=false ← bug
fixed = compile match=true ← fix

🤖 Generated with Claude Code

On Windows, the compile command is never detected because
`strings.TrimSuffix(goCmd, ".exe")` operates on the full path
(e.g. `C:\...\compile.exe` → `C:\...\compile`) instead of the
base name. The comparison `goCmdBase == "compile"` always fails.
Fix: use `goCmdBase` instead of `goCmd` in TrimSuffix.
@pingcap-cla-assistant

pingcap-cla-assistantBot commented Apr 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@kennytm
kennytm merged commit bbc9d10 into pingcap:masterApr 6, 2026
2 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@hulucc@kennytm