From e5a4c70a43fd8cae2ab3b1336e27b8a47199beec Mon Sep 17 00:00:00 2001 From: Ben Hillis Date: Wed, 25 Mar 2026 09:02:23 -0700 Subject: [PATCH 1/2] diagnostics: switch log archive from zip to tar.gz --- diagnostics/collect-wsl-logs.ps1 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/diagnostics/collect-wsl-logs.ps1 b/diagnostics/collect-wsl-logs.ps1 index 139c3ba4c..dfe0e5097 100644 --- a/diagnostics/collect-wsl-logs.ps1 +++ b/diagnostics/collect-wsl-logs.ps1 @@ -328,8 +328,15 @@ if ($Dump) } } -$logArchive = "$(Resolve-Path $folder).zip" -Compress-Archive -Path $folder -DestinationPath $logArchive -Remove-Item $folder -Recurse - -Write-Host -ForegroundColor Green "Logs saved in: $logArchive. Please attach that file to the GitHub issue." +$logArchive = "$(Resolve-Path $folder).tar.gz" +tar.exe -czf $logArchive $folder +if ($LASTEXITCODE -eq 0) +{ + Remove-Item $folder -Recurse + Write-Host -ForegroundColor Green "Logs saved in: $logArchive. Please attach that file to the GitHub issue." +} +else +{ + Remove-Item $logArchive -ErrorAction Ignore + Write-Host -ForegroundColor Red "Failed to compress logs. They are available in: $(Resolve-Path $folder)" +} From 90f548954d0e390a462548f7880af3c423666090 Mon Sep 17 00:00:00 2001 From: Ben Hillis Date: Fri, 3 Apr 2026 07:05:42 -0700 Subject: [PATCH 2/2] Fall back to zip if tar.exe fails Some Windows SKUs may not have tar.exe available. Fall back to Compress-Archive (zip) when tar fails, so log collection still works in those environments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- diagnostics/collect-wsl-logs.ps1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/diagnostics/collect-wsl-logs.ps1 b/diagnostics/collect-wsl-logs.ps1 index dfe0e5097..5ebbab2b9 100644 --- a/diagnostics/collect-wsl-logs.ps1 +++ b/diagnostics/collect-wsl-logs.ps1 @@ -338,5 +338,18 @@ if ($LASTEXITCODE -eq 0) else { Remove-Item $logArchive -ErrorAction Ignore - Write-Host -ForegroundColor Red "Failed to compress logs. They are available in: $(Resolve-Path $folder)" + + # Fall back to zip if tar fails (e.g. on SKUs that lack tar.exe) + $logArchive = "$(Resolve-Path $folder).zip" + try + { + Compress-Archive -Path $folder -DestinationPath $logArchive -Force + Remove-Item $folder -Recurse + Write-Host -ForegroundColor Green "Logs saved in: $logArchive. Please attach that file to the GitHub issue." + } + catch + { + Remove-Item $logArchive -ErrorAction Ignore + Write-Host -ForegroundColor Red "Failed to compress logs. They are available in: $(Resolve-Path $folder)" + } }