fix: extract .tar.7z snap template archives correctly - #10003
Merged
Conversation
Since the app-builder Go-to-TS migration (26.15.0), extractArchive() had no .tar.7z case: snap template archives fell through to the plain .7z branch, so only the outer 7z layer was removed and default-config snap builds packed the inner tar as a single file instead of the template contents (desktop-init.sh etc). Builds succeeded silently; the snaps failed at launch. - route .tar.7z through the decompress-then-untar path used for .tar.xz (7za strips the outer layer, node-tar extracts the inner tar with strip: 1) - strip the full .tar.7z extension in the toolset cache dir name; the rename deliberately busts caches poisoned by the broken extraction, which would otherwise pass the cache-complete check forever after upgrading - add a focused extractArchive regression test against a crafted .tar.7z fixture and an end-to-end downloadBuilderToolset test via a local server Fixes #10002 Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VmEdZ2geUz4KSzYewFyB9M
🦋 Changeset detectedLatest commit: f679d82 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
mmaietta
approved these changes
Jul 10, 2026
mmaietta
pushed a commit
that referenced
this pull request
Jul 11, 2026
liamcmitchell
added a commit
to liamcmitchell/electron-builder
that referenced
this pull request
Jul 13, 2026
* origin/master: feat(updater): fix manifest sha512 hash-encoding sniffing, add opt-in Linux package-signature verification (electron-userland#9990) fix: don't empty locales dir when electronLanguages uses bare language codes (electron-userland#10007) fix: extract .tar.7z snap template archives correctly (electron-userland#10003)
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.
Requested by Samuel Attard · Slack thread
Before: building a snap with the default configuration (the
useTemplateApptemplate path) on 26.15.0–26.15.6 succeeds without any error or warning, but the resulting snap dies at launch:desktop-init.sh: No such file or directory. The snap-template archive was packed into the snap as a single stray.tarfile instead of its contents (desktop-init.sh,desktop-common.sh,desktop-gnome-specific.sh,usr/, …).After: the template extracts correctly again, the desktop scripts land at the snap root with their executable modes intact, and built snaps launch. Upgrading users pick up the fix automatically — no manual cache clearing needed.
How
.tar.7zextraction: since the Goapp-builder→ TypeScript migration (feat(migration): fully replace Go binaryapp-builder-binwith TS implementation #9829, released in 26.15.0), snap template downloads go throughextractArchive()inpackages/app-builder-lib/src/util/electronGet.ts, which had no.tar.7zcase. The template archives (e.g.snap-template-electron-4.0-2-amd64.tar.7z) matched the plain.7zbranch, so only the outer 7z layer was removed..tar.7zis now routed through the same decompress-then-untar path as.tar.xz/.txz: 7za strips the outer layer to the inner tar, then node-tar extracts it withstrip: 1(the inner tars are./-prefixed), reproducing the layout the Go binary used to produce, includingdesktop-init.shmode 755. The.tar.7zcheck runs before the plain.7zmatch.downloadBuilderToolset()now strips the full.tar.7zextension (previously only.7z, leaving<name>.tar-<hash>dirs). This is deliberate: caches poisoned by the broken extraction pass the cache-complete check and would otherwise never be re-fetched after upgrading — the new dir name forces a clean re-extraction.extractArchivetest against a crafted.tar.7zfixture (7z layer around a./-prefixed tar with a mode-755desktop-init.sh) asserting the extracted layout, file mode, and that no stray inner.tarremains — it reproduces the exact 26.15.x symptom when run against the unfixed code — plus an end-to-enddownloadBuilderToolsettest via the existing local-server pattern that also asserts the new cache dir name. A full template-path snap build with content assertions needs theRUN_SNAP_TESTSDocker containers (unsquashfs/Xvfb), so the fixture-based tests are the CI-runnable guard.Fixes #10002
Credit to @aek-innonova for the excellent diagnosis — root cause, the poisoned-cache warning, and the proposed one-line routing fix, all verified — in the issue report.
cc @mmaietta
Generated by Claude Code