fix: actually generate the UTF-8 locale makensis needs

`locale-gen <name>` is an Ubuntu extension; plain Debian's locale-gen
takes no arguments and only reads /etc/locale.gen, so the previous fix
generated nothing and makensis kept aborting with exit 84 / "FATAL: main
argv conversion failed!" under the runner's C/POSIX locale.

Write the entry into /etc/locale.gen, run locale-gen with no arguments,
and assert `locale -a` lists it — a missing locale now fails the install
step with a clear message instead of dying four minutes later inside
electron-builder.

build-release.ps1 sets LC_ALL/LANG itself before packaging a Windows
target on a Linux host, picking a real UTF-8 locale out of `locale -a`.
The electron-builder child then inherits it however the script was
started, including a runner that drops step env.

Also adds a non-fatal probe step that runs the cached makensis with
-VERSION under en_US.UTF-8 and under C, so a failure that is *not* the
locale is distinguishable from one that is without another blind fix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-28 15:42:43 +02:00
co-authored by Claude Opus 5
parent f5ad546c62
commit d4f23f5b87
2 changed files with 91 additions and 3 deletions
+35 -3
View File
@@ -63,9 +63,22 @@ jobs:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y jq wine locales
# C.UTF-8 is glibc >=2.35 only (Debian 12+); en_US.UTF-8 works on any
# Debian version and just needs generating once.
sudo locale-gen en_US.UTF-8
# makensis converts its argv through the locale charset and aborts with
# "FATAL: main argv conversion failed!" under C/POSIX. C.UTF-8 is a glibc
# built-in only from 2.35 (Debian 12+), so en_US.UTF-8 is generated instead.
#
# `locale-gen <name>` is an Ubuntu extension: plain Debian's locale-gen
# takes no arguments and only reads /etc/locale.gen, so the entry goes in
# there first. The anchored grep does not match the line the package ships
# commented out.
grep -q '^en_US.UTF-8 UTF-8' /etc/locale.gen \
|| echo 'en_US.UTF-8 UTF-8' | sudo tee -a /etc/locale.gen
sudo locale-gen
locale -a
locale -a | grep -qiE '^en_US\.utf-?8$' || {
echo "en_US.UTF-8 was not generated; makensis will abort on argv conversion" >&2
exit 1
}
- name: Ensure PowerShell
# Debian ships no snapd by default, so this pulls Microsoft's portable
@@ -82,6 +95,25 @@ jobs:
sudo ln -sf /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh
sudo chmod +x /opt/microsoft/powershell/7/pwsh
- name: makensis locale probe
# Diagnostic only, never fails the job. If `-VERSION` prints a version under
# en_US.UTF-8 and "FATAL: main argv conversion failed!" under C, the locale
# really is the whole story. If it fails under both, it is not the locale and
# the next thing to try is DEBUG=electron-builder on the build step to see the
# argv makensis is actually handed. Prints nothing useful on the very first
# run of a fresh runner, where the NSIS bundle has not been downloaded yet.
continue-on-error: true
run: |
locale || true
mk=$(find "$HOME/.cache/electron-builder" /var/lib/gitea-runner/.cache/electron-builder \
-type f -name makensis -path '*/linux/*' 2>/dev/null | head -n1)
echo "makensis: ${mk:-<not downloaded yet>}"
[ -n "$mk" ] || exit 0
echo "--- LC_ALL=en_US.UTF-8"
LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 "$mk" -VERSION || echo "failed, exit $?"
echo "--- LC_ALL=C"
LC_ALL=C LANG=C "$mk" -VERSION || echo "failed, exit $?"
- name: Build Windows installers + Linux AppImage
shell: pwsh
env: