Wax/Trace: heal 218-378-13 cal disc filename bug + VC++ 2017 + picker
09-Setup-WaxAndTrace.ps1 Step 3: - Detect Mitutoyo's burn-time typo on 218-378-13 series cal discs (filenames carry a trailing space inside the probe ID component, e.g. "Linear_X_218-378-13 _100072210.txt"). Their own .NET Setup.exe calls FileSystemInfo.set_Attributes on the source path and throws System.ArgumentException because the path contains an embedded space component, crashing every cal apply on 218-378-13 bays (exit -532462766 = 0xE0434352, .NET unhandled exception). Confirmed via WER Event 1026 captured during today's WJF00159 imaging. - When the buggy filenames are detected, bypass the broken vendor Setup.exe and direct-copy data\*.* into C:\Program Files (x86)\MitutoyoApp\Formtracepak\data\, renaming each file to strip ' _' (space-underscore) -> '_'. Clear read-only attr on each landed file. Older 218-458A discs have clean filenames and still use the vendor Setup.exe path. waxtrace-manifest.json: - Drop DetectionValue=v14.15.26706 from both VC++ 2017 redist entries. Windows Update routinely bumps the VS14 runtime to 14.16+ / 14.3x+, the older Mitutoyo redist refuses to install over the newer (exit 1638 'Another version already installed') and the manifest engine marked it as failed even though the runtime was fine. Detection is now by registry-key+name presence, which any VC++ 2015-2022 redist satisfies (they are backward-compatible). startnet.cmd:prompt_waxtrace_asset: - Replace free-text input with select-waxtrace-asset.ps1 arrow-key picker driven from installers-post/waxtrace/calibrations/INDEX.csv. - Map Y: enrollment share early so the picker can read INDEX.csv. - Replace parens-in-parens block (echo of '(e.g. WJRP2335)' inside the if-paren caused 'to was unexpected at this time' parse error observed by tech mid-imaging) with goto-flow. - Fall back to free-text prompt if picker unavailable or operator presses Esc. select-waxtrace-asset.ps1: - Sort bays descending by asset tag so WJRP* lands at top of menu. - Also staged as gea-shopfloor-waxtrace/select-waxtrace-asset.ps1 so sync-waxtrace.sh ships it to installers-post/waxtrace/ on the share. sync-waxtrace.sh: - Push select-waxtrace-asset.ps1 next to INDEX.csv on the share. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -164,20 +164,76 @@ if (-not $asset) {
|
||||
Write-WTLog "Mounting cal ISO: $($candidate.FullName)"
|
||||
try {
|
||||
$img = Mount-DiskImage -ImagePath $candidate.FullName -PassThru -ErrorAction Stop
|
||||
Start-Sleep -Seconds 2
|
||||
$calDrive = ($img | Get-Volume).DriveLetter
|
||||
Write-WTLog " mounted at ${calDrive}:"
|
||||
$calSetup = "${calDrive}:\Setup.exe"
|
||||
if (Test-Path -LiteralPath $calSetup) {
|
||||
Write-WTLog " running cal Setup.exe (may prompt - VB6 wrapper, same vintage as main installer)"
|
||||
# Cal ISO Setup.exe is tiny (135KB) - if it prompts, user has to click through.
|
||||
# Acceptable today; future: dark-deploy the data/*.txt files directly into
|
||||
# the FormTracePak data dir + skip Setup.exe.
|
||||
$p = Start-Process -FilePath $calSetup -WorkingDirectory "${calDrive}:\" -Wait -PassThru
|
||||
Write-WTLog " cal Setup.exe exit $($p.ExitCode)"
|
||||
} else {
|
||||
Write-WTLog " cal Setup.exe not found on ISO at $calSetup" 'WARN'
|
||||
Start-Sleep -Seconds 5
|
||||
$calDrive = (Get-DiskImage -ImagePath $candidate.FullName | Get-Volume).DriveLetter
|
||||
$calRoot = "${calDrive}:\"
|
||||
Write-WTLog " mounted at $calRoot"
|
||||
|
||||
# Disc layout differs by probe series. We have observed two:
|
||||
#
|
||||
# Older 218-458A: E:\App.ini, E:\Setup.exe, E:\data\CVIFDLL.ini,
|
||||
# E:\data\Cvif_Correction.exe, E:\data\<files>.txt.
|
||||
# Vendor Setup.exe works (VB6, may prompt).
|
||||
#
|
||||
# Newer 218-378-13: E:\setup.bat, E:\setup.exe (.NET 4.0),
|
||||
# E:\iniStatus\<png>, E:\data\cvifdll.ini,
|
||||
# E:\data\<files>.txt - BUT the filenames have a
|
||||
# bug: probe ID ends with a TRAILING SPACE
|
||||
# ("218-378-13 _100072210.txt"). The vendor's
|
||||
# .NET Setup.exe calls FileSystemInfo.set_Attributes
|
||||
# on the source path and throws System.ArgumentException
|
||||
# because the path contains an embedded space
|
||||
# component, crashing every time
|
||||
# (exit -532462766 = 0xE0434352, .NET unhandled
|
||||
# exception). See diag-cal.log, WER Event 1026.
|
||||
#
|
||||
# We bypass the vendor wrapper entirely when the disc carries
|
||||
# the buggy filenames and do a direct file copy into FormTracePak's
|
||||
# data dir, renaming each file to strip the trailing space.
|
||||
$srcDataDir = Join-Path $calRoot 'data'
|
||||
$dstDataDir = 'C:\Program Files (x86)\MitutoyoApp\Formtracepak\data'
|
||||
|
||||
$hasBrokenFilenames = $false
|
||||
if (Test-Path -LiteralPath $srcDataDir) {
|
||||
$hasBrokenFilenames = [bool](Get-ChildItem -LiteralPath $srcDataDir -Filter '*[0-9] _*.txt' -ErrorAction SilentlyContinue | Select-Object -First 1)
|
||||
}
|
||||
|
||||
if ($hasBrokenFilenames) {
|
||||
Write-WTLog " disc has trailing-space probe-ID filenames (218-378-13 series) - bypassing buggy vendor Setup.exe, doing direct copy"
|
||||
if (-not (Test-Path -LiteralPath $dstDataDir)) {
|
||||
Write-WTLog " destination data dir does not exist: $dstDataDir" 'ERROR'
|
||||
Write-WTLog " (FormTracePak install may not be complete; cal apply aborted)" 'ERROR'
|
||||
} else {
|
||||
$copied = 0
|
||||
Get-ChildItem -LiteralPath $srcDataDir -File -ErrorAction SilentlyContinue | ForEach-Object {
|
||||
# Strip ' _' (space-underscore) -> '_' inside the filename to
|
||||
# heal the Mitutoyo burn-time typo. cvifdll.ini etc unaffected.
|
||||
$cleanName = $_.Name -replace ' _', '_'
|
||||
$dst = Join-Path $dstDataDir $cleanName
|
||||
try {
|
||||
Copy-Item -LiteralPath $_.FullName -Destination $dst -Force -ErrorAction Stop
|
||||
# Clear read-only on the destination so future overwrites work.
|
||||
try { (Get-Item -LiteralPath $dst).Attributes = 'Normal' } catch {}
|
||||
Write-WTLog " copied $($_.Name) -> $cleanName"
|
||||
$copied++
|
||||
} catch {
|
||||
Write-WTLog " copy failed for $($_.Name): $_" 'ERROR'
|
||||
}
|
||||
}
|
||||
Write-WTLog " direct copy complete: $copied file(s) into $dstDataDir"
|
||||
}
|
||||
} else {
|
||||
# Older-style disc (clean filenames). Vendor Setup.exe is reliable.
|
||||
$calSetup = "${calDrive}:\Setup.exe"
|
||||
if (Test-Path -LiteralPath $calSetup) {
|
||||
Write-WTLog " running cal Setup.exe (may prompt - VB6 wrapper, same vintage as main installer)"
|
||||
$p = Start-Process -FilePath $calSetup -WorkingDirectory $calRoot -Wait -PassThru
|
||||
Write-WTLog " cal Setup.exe exit $($p.ExitCode)"
|
||||
} else {
|
||||
Write-WTLog " cal Setup.exe not found at $calSetup" 'WARN'
|
||||
}
|
||||
}
|
||||
|
||||
Dismount-DiskImage -ImagePath $candidate.FullName -ErrorAction SilentlyContinue | Out-Null
|
||||
Write-WTLog " cal ISO dismounted"
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user