SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

SMAPI 4.0.0/.1 MacOS launch failure due to bash error setlocale causing infinite recursion.

OWL4C opened this issue ยท 1 comments

commented

Describe the bug
When launching the game through steam it creates a Terminal, that for some reason or other fails to set the locale, leading to a spurious error in .net. Running both the launch .command in /tmp/ and the smapi file that is called from there in a Terminal works fine.
I found another user with a similar problem on reddit https://www.reddit.com/r/SMAPI/comments/1bjjp2b/infinite_recursion_error_when_installingupdating/ but couldn't yet verify if it is the same error.
The error: bash: warning: setlocale: LC_ALL: cannot change locale (en_GB,): No such file or directory Process terminated. Infinite recursion during resource lookup within System.Private.CoreLib. This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names. Resource name: Argument_CultureNotSupported at System.Environment.FailFast(System.String) at System.SR.InternalGetResourceString(System.String) at System.SR.GetResourceString(System.String) at System.Globalization.CultureInfo.GetCultureNotSupportedExceptionMessage() at System.Globalization.CultureInfo..ctor(System.String, Boolean) etc

To Reproduce
Install SMAPI 4.0.0 or 4.0.1
Launch through Steam -> creates a terminal that breaks (bash tries to set the locale to 'en_GB,' as far as i understand, the comma is breaking the setup)
Copy the command being executed (i.e. /tmp/open-smapi-terminal.command) or the path of the actual application being launched within
Run that with either zsh or bash -> works
I am guessing this is highly localized to mac users which language settings interfere with the launch.

Fix
Running the steam with --use-current-shell somehow correctly imports the correct locale variables. However, this stops any terminal from appearing.
A more permanent fix that should always work is adding the following line at line 58 (so it is the second line being added in the /tmp/open-smapi-terminal.command) into the SMAPI launch script:
echo 'export LC_ALL=en_GB' >> /tmp/open-smapi-terminal.command
This will ensure that LC_ALL is set to en_GB when starting up the game even from within steam, fixing the issue. However, this might make SMAPI run in en_GB regardless of the users wanted language, or it might not, if the bash locale isn't used. The actual game should however be completely unaffected by the locale setting.

commented

Also unable to launch on Linux via Lutris with wine, but if run through a terminal (bash Lutris command or internal Lutris wine windows commandline) it works fine, no need to set locale or pass any command line options.
Given the crash is at the very start before any SMAPI error logging & your stacktrace contains CultureInfo errors & this is a new issue with 1.6 SMAPI, wonder if it's related to:
ad06f6e#diff-0dc50e5b2fdc87e3f83c1d0fe9232ba045e2fa54d6085c68beb923be92fd27bfR34
Need to get my error log later
FYI don't install Lutris via flatpak, so many more issues.