Repository navigation
wslconfig: write autoMemoryReclaim under [experimental], where WSL reads it - #553
Merged
Merged
Conversation
…ads it WSL reads the key only as experimental.autoMemoryReclaim; under [wsl2] it is an Unknown key and ignored, so wsl.auto-memory-reclaim never took effect. Keys now carry their section, a line an earlier release left under [wsl2] is moved by the next apply (shown in the diff), and Get/All report only what WSL reads. Fixes #550
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WSL reads
autoMemoryReclaimonly asexperimental.autoMemoryReclaim.skrog wsl-config applywrote it under[wsl2], where WSL ignores it withUnknown key 'wsl2.autoMemoryReclaim', sowsl.auto-memory-reclaimhas never had any effect.Change
internal/wslconfig: keys now carry their section (SectionOf), andautoMemoryReclaimgoes under[experimental].GetandAllread from the section WSL uses, sowsl-config showandskrog topstop reporting the ignored line as in effect.[wsl2],Planmoves it, and the diff says why:wsl-config --json: pending changes gainsection, plusmoved_fromwhen a line is moved. Both additions are additive.skrog top: the hint now names[experimental]and includes thewsl-config applystep it was missing.vm-sizing.md,memory.md,cli-json.mdand CHANGELOG.Verified
On a real machine (WSL 3.0.3, Windows 10 22H2), starting from the file the released 0.8.0 binary writes:
config set+wsl-config apply --yeswrites the key under[wsl2]. Afterwsl --shutdown, WSL printsUnknown key 'wsl2.autoMemoryReclaim'.wsl-configshows the move diff above, andapply --yesmoves the line under[experimental]. A secondwsl-configreports nothing pending.wsl.execall that booted the VM printed noUnknown keyline.DNS Tunneling is not supported, which this machine prints on every cold start. The supervisor booted the VM first on three tries, and those outputs were empty and not counted.[experimental]does produceUnknown key 'experimental.autoMemoryReclaimX', so WSL does validate that section.~/.wslconfigand Skrog's config were restored afterwards. The file matches its backup byte for byte.Negative control: with
SectionOfreverted to always returnwsl2, 6 tests ininternal/wslconfigfail. That includes every new behaviour test: the key is written under[experimental], a[wsl2]copy isn't reported as effective, a stale copy is moved, and only the dead copy is removed when the live one is already right.go test ./...passes. Locally,scripts/lint.ps1fails only atgovulncheck, on Go standard-library advisories fixed in go1.27.2; this machine has 1.27.1. CI installs the current stable Go.Fixes #550