cyrusimap / cassandane

Other
6 stars 11 forks source link

Cassandane does not work properly with non-english locales #8

Closed brong closed 13 years ago

brong commented 13 years ago

From: Julien Coloos Bugzilla-Id: 3509 Version: unspecified Owner: Greg Banks

brong commented 13 years ago

From: Julien Coloos

Some Cassandane tests fail if locales are non-english. It appears to be related to the way dates are formatted (strftime function).

Example, with the 'Cassandane::Test::DateTime' test, in 'fr' locale: .F Time: 0 wallclock secs ( 0.05 usr + 0.00 sys = 0.05 CPU)

!!!FAILURES!!! Test Results: Run: 1, Failures: 1, Errors: 0

There was 1 failure: 1) Cassandane/Test/DateTime.pm:63 - test_basic(Cassandane::Test::DateTime) expected 'Fri, 15 Oct 2010 03:19:52 +1100', got 'ven., 15 oct. 2010 03:19:52 +1100'

Test was not successful.

A quick workaround is to override the locales upon launching the test. For example: LC_ALL=POSIX sudo -u cyrus ./testrunner.pl -f tap

But it may be preferable to ensure a consistent locale explicitly. For example using a BEGIN block inside testrunner.pl: BEGIN {

Enforce locale before anything else

use POSIX qw(locale_h);

setlocale(LC_ALL, 'POSIX');

}

See commit 921f73c90f0e8a2aefcce020adfee6dfed9fe297 in git://github.com/worldline-messaging/cassandane.git for the latter.

PS: bug associated to Cyrus IMAP component since there does not seem to be one dedicated to Cassandane (yet ?).

brong commented 13 years ago

From: Greg Banks

I'll take this one.

brong commented 13 years ago

From: Greg Banks

Ok, so the problem was that to_rfc822() was using strftime("%a %b") which are locale-specific instead of generating fixed POSIX-like strings as per the RFC. Fixed in this commit

http://git.cyrusimap.org/cassandane/commit/?id=b86d9a3f3040d551d9366a8de38f0e8ebdabf127

brong commented 13 years ago

From: Jeroen van Meeuwen (Kolab Systems)

Correcting product / component