Skip to content

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

@OWL4C

Description

@OWL4C

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions