Browse Source
Field report (jcross1, Windows PowerShell 5): Get-FileHash not recognized during list -remote while Write-Host/Invoke-WebRequest worked. Root cause class: Get-FileHash is a SCRIPT-defined function in PS 5.1's Microsoft.PowerShell.Utility, resolved via PSModulePath autoload - a damaged PSModulePath (pwsh7 path pollution, overridden env, redirected user module dirs) removes it while the module's compiled cmdlets keep working. Effects were wrong results, not just noise: spurious UPDATE AVAILABLE rows (null local hash) and fail-closed fetch verification. New Get-PunkFileSha1 computes sha1 via .NET (SHA1.Create over a stream, lowercase hex) at all three former Get-FileHash sites; works on any PowerShell edition/state incl FIPS, and emits a one-time informational note when the damaged condition is detected (chosen over detect-and-offer-install/env-repair: nothing to install once the dependency is gone, and persistent environment mutation from a fetch tool is disproportionate). Bash payload already probes sha1sum/shasum/sha1/openssl - unchanged. bin/AGENTS.md records the no-script-module-cmdlets payload rule. Verified: hash parity with Get-FileHash under powershell 5 and pwsh 7; list -remote via the rewrapped .cmd (correct Same-version rows); damaged-PS simulation (probe forced unresolvable): note printed once, zero errors, hashing correct; scriptwrap roundtrip pin runtimecmd_roundtrip PASS (payload + regenerated bin output committed together). CHANGELOG bullet added under the in-flight 0.19.0 entry (rides the user's pending release-notes commit). Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.commaster
3 changed files with 90 additions and 12 deletions
Loading…
Reference in new issue