flatpak icon indicating copy to clipboard operation
flatpak copied to clipboard

[Bug]: "Locale not supported by C library" leading to "flatpak-spawn: Invalid byte sequence in conversion input"

Open espadrine opened this issue 9 months ago • 8 comments

Checklist

  • [X] I agree to follow the Code of Conduct that this project adheres to.
  • [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.
  • [X] If this is an issue with a particular app, I have tried filing it in the appropriate issue tracker for the app (e.g. under https://github.com/flathub/) and determined that it is an issue with Flatpak itself.
  • [X] This issue is not a report of a security vulnerability (see here if you need to report a security issue).

Flatpak version

1.12.7

What Linux distribution are you using?

Ubuntu

Linux distribution version

22.04.1

What architecture are you using?

x86_64

How to reproduce

  1. Download Foliate from KDE Discover application (a Flatpak by default).
  2. Remove any export PS1='$ ' in ~/.bashrc etc; using instead PS1='$ ' (without the export) is fine, and will be used by the terminal, but will also reproduce the error. Ensure that the variable is not exported by checking that env | grep PS1 returns nothing.
  3. In a terminal, run flatpak run --branch=stable --arch=x86_64 --command=com.github.johnfactotum.Foliate --file-forwarding com.github.johnfactotum.Foliate @@u `pwd`/seriouscryptography.epub @@. You may replace seriouscryptography.epub with whichever epub file you have in the current directory. (The behaviour is consistent from within Konsole, Alacritty, and from simply opening an epub from Dolphin.)

Expected Behavior

The epub loads correctly. Example successful log:

(com.github.johnfactotum.Foliate:2): Gtk-WARNING **: 18:26:58.290: Locale not supported by C library.
	Using the fallback 'C' locale.
Portal call failed: Failed to start command: Failed to execute child process ?dict? (No such file or directory)
Portal call failed: Failed to start command: Failed to execute child process ?sdcv? (No such file or directory)

(process:2): Gtk-WARNING **: 18:26:59.122: Locale not supported by C library.
	Using the fallback 'C' locale.
Failed to create /home/tyl/.var/app/com.github.johnfactotum.Foliate/cache for shader cache (No such file or directory)---disabling.

(com.github.johnfactotum.Foliate:2): Gjs-WARNING **: 18:27:01.657: Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await expression. Stack trace of the failed promise:
  main@resource:///com/github/johnfactotum/Foliate/js/main.js:478:24
  run@resource:///org/gnome/gjs/modules/script/package.js:206:19
  @/app/bin/com.github.johnfactotum.Foliate:9:17

Actual Behavior

The app spins forever, indicating a crash. The log indicates a flatpak-spawn error.

Example failed log:

(com.github.johnfactotum.Foliate:2): Gtk-WARNING **: 18:25:49.067: Locale not supported by C library.
	Using the fallback 'C' locale.
Portal call failed: Failed to start command: Failed to execute child process ?dict? (No such file or directory)
Portal call failed: Failed to start command: Failed to execute child process ?sdcv? (No such file or directory)
flatpak-spawn: Invalid byte sequence in conversion input
Try "flatpak-spawn --help" for more information.

Additional Information

Successful workaround (used to show the expected behaviour) include setting $PS1 as with the following command:

PS1= flatpak run --branch=stable --arch=x86_64 --command=com.github.johnfactotum.Foliate --file-forwarding com.github.johnfactotum.Foliate @@u `pwd`/seriouscryptography.epub @@

or exporting $PS1 in .bashrc or the equivalent configuration file (although that will not work when opening from Dolphin: in that case, set the Exec entry in ~/.local/share/applications/com.github.johnfactotum.Foliate.desktop as Exec=env PS1= /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=com.github.johnfactotum.Foliate --file-forwarding com.github.johnfactotum.Foliate @@u %U @@, or by right-clicking on the menu, clicking "Edit Applications", selecting Foliate, updating the field for environment variables, and saving).

espadrine avatar Oct 21 '23 17:10 espadrine