Ticket #495 (closed task: fixed)

Opened 3 years ago

Last modified 2 years ago

Warn when locale is bogus

Reported by: Philip Owned by: sergiovier
Priority: Nice to Have Milestone: Alpha 4
Component: Core engine Keywords: simple, review
Cc:

Description

What currently happens:

$ LANG=bogus ./pyrogenesis_dbg
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Aborted

This can happen on misconfigured systems where the locales aren't set up correctly. It would be better to give a much more informative warning and fall back to a default - e.g. perl says:

$ LANG=bogus perl
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "",
        LC_ALL = (unset),
        LANG = "bogus"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

which is more helpful.

We need to do this fairly early (before any attempts to access the filesystem), so maybe in EarlyInit in GameSetup.cpp.

Attachments

patch.diff (2.2 KB) - added by sergiovier 2 years ago.

Change History

comment:1 Changed 3 years ago by anonymous

  • Milestone Unclassified deleted

Milestone Unclassified deleted

comment:2 Changed 3 years ago by wacko

  • Milestone set to Backlog

Changed 2 years ago by sergiovier

comment:3 Changed 2 years ago by sergiovier

  • Keywords simple, review added; simple removed

Based on commnets on the code in http://www.wildfiregames.com/forum/index.php?showtopic=13145&hl= i've created this patch.

comment:4 Changed 2 years ago by sergiovier

  • Owner set to sergiovier

comment:5 Changed 2 years ago by Philip

  • Milestone changed from Backlog to Alpha 4

Thanks! Changed it to only apply to OS_UNIX (I assume it wouldn't work on Windows and shouldn't be necessary there anyway), and to use debug_warn for serious warnings (so users can't miss them), and cleaned up the formatting a bit.

comment:6 Changed 2 years ago by philip

  • Status changed from new to closed
  • Resolution set to fixed

(In [8913]) Fix #495 (warn when locale is bogus), based on patch from darrenhoffman and sergiovier

Note: See TracTickets for help on using tickets.