09-Setup-WaxAndTrace: fix broken-filename detection (Get-ChildItem -Filter)

The direct-copy bypass added earlier was never firing - Get-ChildItem -Filter
uses Win32 filename filtering and does NOT honor PowerShell wildcards or
character classes. The previous detection filter '*[0-9] _*.txt' matched
literal bracket-zero-through-nine text, which never appears in any
filename. $hasBrokenFilenames was therefore always False, and every
218-378-13 series cal apply fell through to the vendor setup.exe which
crashes with System.ArgumentException (exit -532462766).

Confirmed via debug-waxtrace-cal.ps1 log on WJF00159: section 6 reports
the on-disk script has the direct-copy fix, section 7 shows the actual
runtime log line 'running cal Setup.exe' followed by exit -532462766.
The "fix" was never executing because the gate was broken.

Replace -Filter with Get-ChildItem -File + Where-Object regex match on
' _\d+\.txt$' which catches the actual buggy filename pattern (space-
underscore-digits-.txt at end of name) regardless of probe series.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-05-22 14:09:10 -04:00
parent 7f93347f74
commit de3018512a

View File

@@ -195,7 +195,15 @@ if (-not $asset) {
$hasBrokenFilenames = $false
if (Test-Path -LiteralPath $srcDataDir) {
$hasBrokenFilenames = [bool](Get-ChildItem -LiteralPath $srcDataDir -Filter '*[0-9] _*.txt' -ErrorAction SilentlyContinue | Select-Object -First 1)
# Get-ChildItem -Filter uses Win32 filtering and does NOT
# honor PowerShell wildcards / character classes - '[0-9]'
# would match literal bracketed text. Use -Include +
# Where-Object regex instead. The bug signature is
# ' _' (space-underscore) inside the filename, e.g.
# 'Linear_X_218-378-13 _100072210.txt'.
$hasBrokenFilenames = [bool](Get-ChildItem -LiteralPath $srcDataDir -File -ErrorAction SilentlyContinue |
Where-Object { $_.Name -match ' _\d+\.txt$' } |
Select-Object -First 1)
}
if ($hasBrokenFilenames) {