[Tudu] tudu v0.8.1

Enrique Matías Sánchez (Quique) cronopios at gmail.com
Thu Aug 18 13:51:33 CEST 2011


2011/8/16 Ruben Pollan:

>> I've built it on Mac OS X 10.6.8. It compiles without warnings, but
>> when launching it, it crashes:
>>
>> $ tudu
>> terminate called after throwing an instance of 'std::runtime_error'
>>   what():  locale::facet::_S_create_c_locale name not valid
>> Abort trap
>
> I had a similar problem when I tried to run it on freebsd. On freebsd seems to
> be a bug on the C++ std locale implementation.

Indeed, this comes from FreeBSD's Problem Report standards/150093:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=150093


> Doing a fast search seems to be more people with the same problem:
> http://stackoverflow.com/questions/1745045/stdlocale-breakage-on-macos-10-6-with-lang-en-us-utf-8
>
> There might be a work around, but my knowledge about std locale is pretty basic.
> Anyway I'll search around and try to fix it.

Getting the current system locale using the Standard Template Library
call, such as in
    std::cout << std::locale("").name() << std::endl;
throws the above runtime error.

You can still get it and set it using the clocale functions,
    char * systemLocale = std::getenv("LANG");
    std::setlocale(LC_ALL, systemLocale);
or simply
    stdlocale(LC_ALL, "") as tudu currently does.
but you can't use that to set up ifs.imbue(), ofs.imbue() and
file.imbue() because of the above problem.

However, those don't seem to be really necesary on Mac OS X, whose
console uses UTF-8 as default.
I modified the files interface.cc, parser.cc and config.cc catching those calls:
        try {
                file.imbue(locale(""));
        } catch (runtime_error& err) {
                // PR 150093
        }

This way, tudu mostly works on Mac OS X, but has a problem when
reading the XML file next time, not interpreting the encoding
correctly (vim does).
I guess there is a bug there.


-- 
Nothing is enough for the man to whom enough is too little.
 - Ἐπίκουρος


More information about the Tudu mailing list