Skip to content

fix: handle non-ASCII asar paths without a UTF-8 locale - #54655

Merged
jkleinsc merged 2 commits into
electron:mainfrom
awss1i:fix-asar-non-ascii-c-locale
Oct 12, 2026
Merged

jkleinsc merged 2 commits into
electron:mainfrom
awss1i:fix-asar-non-ascii-c-locale

Conversation

@awss1i

@awss1i awss1i commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Description of Change

Fixes #54638.

On Linux, IsArchivePrefix() built its FilePath with FromUTF8Unsafe(), which goes through the C library locale and returns an empty path for non-ASCII input unless that locale is UTF-8. Since #53852 an archive under a folder like ~/Téléchargements is then not recognized, so a main process started without a UTF-8 locale can't load its app, and child_process.fork() children can't read the archive under any locale. This uses the path bytes directly on POSIX.

The new specs run with LC_ALL=C, in Node mode and as an app, and fail without the fix.

Non-ASCII entry names loaded through file: URLs also fail under LC_ALL=C, already on 44.4.2, so I've left that for a separate PR.

Checklist

Release Notes

Notes: Fixed asar archives in non-ASCII folders failing to load on Linux.

IsArchivePrefix() built its FilePath with FromUTF8Unsafe(), which on
Linux decodes through the C library locale and returns an empty path for
non-ASCII input when that locale is not UTF-8. An archive under such a
folder was then not recognized, so a main process started with no locale
or LC_ALL=C could not load its app, and ELECTRON_RUN_AS_NODE children
such as child_process.fork() could not read the archive under any
locale. Use the path bytes directly on POSIX.

Assisted-By: Claude Opus 5.5, Claude Code
@welcome

welcome Bot commented Oct 6, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖

Semantic PR titles

We 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:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Commit signing

This repo enforces commit signatures for all incoming PRs.
To sign your commits, see GitHub's documentation on Telling Git about your signing key.

PR tips

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

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.

@release-clerk

release-clerk Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Suggested release note (advisory)

The Notes: line in this PR passes the style rules. Claude reviewed it for how it reads to app developers and suggests this rewrite:

Notes: Fixed asar archives in non-ASCII folders failing to load on Linux when the locale is not UTF-8.
  • Added the non-UTF-8 locale condition from the PR title, since it limits which apps and systems are affected.

This suggestion was generated automatically, so use your best judgment. This comment will update as the PR description is edited.

Comment thread shell/common/asar/asar_util.cc Resolved
Comment thread spec/asar.spec.ts Resolved
@awss1i

awss1i commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

I applied both suggestions in bc4af0b. Without the fix, the Node mode test still fails with ENOTDIR under en_US.UTF-8 now that LC_ALL is gone, and both tests pass with it.

@jkleinsc jkleinsc added semver/patch backwards-compatible bug fixes target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Oct 12, 2026
@jkleinsc
jkleinsc merged commit 16198f8 into electron:main Oct 12, 2026
91 checks passed
@release-clerk

release-clerk Bot commented Oct 12, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed asar archives in non-ASCII folders failing to load on Linux.

@welcome

welcome Bot commented Oct 12, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

@trop

trop Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #54848

@trop

trop Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #54849

@trop trop Bot added in-flight/44-x-y merged/45-x-y PR was merged to the "45-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. and removed target/45-x-y PR should also be added to the "45-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. in-flight/45-x-y in-flight/44-x-y labels Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Bug]: Linux: app.asar in a non-ASCII folder fails to load when no UTF-8 locale is set (regression in 44.4.3)

3 participants