Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#77220 - [electron] Bug in electron-launcher.sh, empty lines in flags-electron.conf cause app launch to fail
Attached to Project:
Community Packages
Opened by Urban Suhadolnik (lightning5) - Saturday, 21 January 2023, 22:17 GMT
Last edited by Caleb Maclennan (alerque) - Thursday, 15 June 2023, 06:53 GMT
Opened by Urban Suhadolnik (lightning5) - Saturday, 21 January 2023, 22:17 GMT
Last edited by Caleb Maclennan (alerque) - Thursday, 15 June 2023, 06:53 GMT
|
DetailsHi,
Recently, I was playing Electron flags in electron-flags.conf file and encountered a bug in electron-launcher.sh (a.k.a. /usr/bin/elecron) script. In case there is multiple empty lines at the end of electron-flags.conf file, startup fails. Running with bash -x shows that empty lines were converted into empty strings as arguments: + exec /usr/lib/electron/electron --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto '' '' '' '' '' '' /usr/lib/discord/app.asar Complete output of bash -x: [strela@stardust bin]$ bash -x ./electron /usr/lib/discord/app.asar + set -euo pipefail + name=electron + flags_file=/home/strela/.config/electron-flags.conf + declare -a flags + [[ -f /home/strela/.config/electron-flags.conf ]] + mapfile -t + for line in "${MAPFILE[@]}" + [[ ! --enable-features=WaylandWindowDecorations =~ ^[[:space:]]*#.* ]] + flags+=("${line}") + for line in "${MAPFILE[@]}" + [[ ! --ozone-platform-hint=auto =~ ^[[:space:]]*#.* ]] + flags+=("${line}") + for line in "${MAPFILE[@]}" + [[ ! '' =~ ^[[:space:]]*#.* ]] ...snip... + flags+=("${line}") + for line in "${MAPFILE[@]}" + [[ ! '' =~ ^[[:space:]]*#.* ]] + flags+=("${line}") + exec /usr/lib/electron/electron --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto '' '' '' '' '' '' /usr/lib/discord/app.asar Electron apps that don't use the default script, like VScode, don't suffer from this problem. VSvode launcher "sed" instead of a bash array to print the flags. Sed command in VScode launching script: "$(sed 's/#.*//' $XDG_CONFIG_HOME/code-flags.conf | tr '\n' ' ')" Solution is to use VScode launching script or to modify the current electron-laucher.sh to use "sed". Modified VScode sript for electron is available in attachments under: "VScode-modified-electron-launcher.sh" Modified electron-laucher.sh to use sed is available in attachments under: "modified electron-launcher.sh" Additional info: * package version(s): all of them Affected apps: * All apps that use /usr/bin/electron to startup * And all apps that copied electron launcher for their own flags (e.g. Discord) Not affected: * Apps with custom starting/flag reading scripts (VScode) and run /usr/lib/electron/electron directly Steps to reproduce: 1. Create electron-flags.conf file with multiple empty lines after the last line 2. Run app with /usr/bin/electron /usr/lib/discord/app.asar (or any app that calls /usr/bin/electron or copies electron-launcher.sh script (e.g. discord)) Workaround: - Remove empty lines in electron-config Regards, Lightning5 |
This task depends upon
electron-flags.conf
Related:
FS#75667Higher robustness of launcher script would be the right thing to do.
It would be helpful if somebody who actually *had* this problem and uses flag files like this could test at least one of those packages and make sure the change works as expected and doesn't break the usual usage.