Repository navigation
fix(prelude): extract compressed files into the native addon cache dir - #309
Merged
Merged
Conversation
deflateSync wrote to ~/.pkg-cache, a second runtime location that is undocumented, not overridable, and shares its name with pkg-fetch's build-time download cache. Use the dir patchDlopen already extracts native addons into (~/.cache/pkg, or PKG_NATIVE_CACHE_PATH) via a shared pkgCacheDir(), so read-only-home hosts can redirect both.
robertsLando
force-pushed
the
fix/bootstrap-homedir-import
branch
from
October 23, 2026 07:21
91a5f38 to
a1a34ab
Compare
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.
Follow-up to #316. That PR fixed the missing
homedirimport from #166, but kept #166's temp location,~/.pkg-cache.Problem
At runtime,
deflateSyncextracts compressed snapshot files into~/.pkg-cache/tmp-*. That gives a packaged binary a second on-disk location next to~/.cache/pkg, where native addons already go. The second location:docs-site/architecture.mdonly mentions~/.cache/pkg)PKG_NATIVE_CACHE_PATH, so a host with a read-only home folder can move the addon cache but compressed files still failplaces.js, andlib/sea.ts)Fix
A new
pkgCacheDir()inbootstrap-shared.jsreturns~/.cache/pkg, orPKG_NATIVE_CACHE_PATH/pkgwhen that variable is set. BothpatchDlopenanddeflateSyncuse it, anddeflateSynccreates the folder before callingmkdtemp.The
homedirimport that #316 added tobootstrap.jsis removed because nothing in that file uses it any more.Nothing depends on
~/.pkg-cacheat runtime: #166 never ran successfully and has not been released. The build-time cache inlib/sea.tsis a separate thing and is unchanged.Verified
test-80-compression-various-file-access,test-50-native-addonandtest-50-native-addon-2(node22) pass withHOMEpointed at an empty folder. The temp folder is created under~/.cache/pkg.PKG_NATIVE_CACHE_PATHset, the temp folder goes under that path instead.yarn lintis clean.