Opened 14 years ago

Closed 13 years ago

Last modified 8 years ago

#495 closed task (fixed)

Warn when locale is bogus

Reported by: Philip Taylor Owned by: Sergio Fabian Vier
Priority: Nice to Have Milestone: Alpha 4
Component: Core engine Keywords: simple
Cc: Patch:

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 (1)

patch.diff (2.2 KB ) - added by Sergio Fabian Vier 13 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by (none), 14 years ago

Milestone: Unclassified

Milestone Unclassified deleted

comment:2 by Andrew, 14 years ago

Milestone: Backlog

by Sergio Fabian Vier, 13 years ago

Attachment: patch.diff added

comment:3 by Sergio Fabian Vier, 13 years ago

Keywords: review added

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

comment:4 by Sergio Fabian Vier, 13 years ago

Owner: set to Sergio Fabian Vier

comment:5 by Philip Taylor, 13 years ago

Milestone: BacklogAlpha 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 by philip, 13 years ago

Resolution: fixed
Status: newclosed

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

comment:7 by sanderd17, 8 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.