Repository navigation
fix: Electron creates temporary icon files and does not delete them after use - #52424
Conversation
|
💖 Thanks for opening this pull request! 💖 Semantic PR titlesWe use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Commit signingThis repo enforces commit signatures for all incoming PRs. PR tipsThings that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
|
For more information on signing commits, see GitHub's documentation on Telling Git about your signing key. |
- Valid packed ICO cleanup - Unpacked ASAR ICO behavior - Missing ICO entry - Missing ASAR archive - Invalid packed ICO cleanup - Repeated loading of the same ICO - Loading multiple distinct ICOs - Loading through an ASAR link
- Exclude icon.asar from the generic repacker so its packed, unpacked, and linked entries keep their intended structure - Assisted-By: GPT 5.6 Sol, OpenCode
…s for the new test.
ckerr
left a comment
There was a problem hiding this comment.
Code LGTM.
TBH I'd also be open to doing this all in-memory to avoid the filesystem round-trip and disk IO edge cases (eg disk full), but that's out-of-scope for a bugfix. If anyone wants to take that on as a refactor for 45-x-y I'd be happy to review.
|
Better, but pointless disk wear and tear is still present. |
|
I come from --- docker/for-win#13826 --- btw |
dsanders11
left a comment
There was a problem hiding this comment.
Is anything preventing using asar::ScopedTemporaryFile::InitFromFile in the implementation, instead of base::ScopedTempDir? Seems like it would be cleaner and stay closer to the current implementation.
This won't work on Windows: I do think the long-term solution is to bypass the temporary directory altogether and do this in-memory though. |
Agreed. I looked into it briefly, and unfortunately an in-memory implementation has some edge cases we'd need to ensure we're properly covering, so for now I'm good with this improvement. |
|
Congrats on merging your first pull request! 🎉🎉🎉 |
|
Release Notes Persisted
|
|
I have automatically backported this PR to "44-x-y", please check out #52477 |
|
I have automatically backported this PR to "43-x-y", please check out #52478 |
|
I have automatically backported this PR to "42-x-y", please check out #52479 |
Description of Change
Fixes #52354
Previously, every ASAR ICO used Archive::CopyFileOut(). For packed files, that function stores the extracted file in Archive::external_files_. Since Electron caches ASAR archives globally, those temporary files remain alive and are never removed normally.
On Windows, Electron temporarily extract an ICO stored inside an ASAR archive before passing it to
LoadImage. The previous implementation cached that extracted file for the lifetime of the process, which left*.tmp.icofiles behind.This change writes packed ICO data to a scoped temporary directory instead. The directory is removed immediately after Windows creates the in-memory
HICON. ICO files marked as unpacked continue to load directly fromapp.asar.unpacked.Checklist
Release Notes
Notes: Fixed an issue where loading ICO files from ASAR archives on Windows left temporary icon files behind.