#276 √ resolved
Max Lapshin

[BUG] ruby/1.8/core/time/at_spec.rb fails with russian locale

Reported by Max Lapshin | January 24th, 2008 @ 11:13 PM | in 1.0 preview

Locale on my Leopard is set to ru_RU.UTF-8. Thus, all time functions return date in russian. It is required somehow to

depend on current locale to expect correct date. It is wrong to expect "Fri", when date function must return "Птн" (friday in russian).

Encoded string in failing expectation means «Чтв Янв», which stands for «Thu Jan» in russian.

BTW: mspec -t ruby .. fails with the same error. Thus 100% spec is invalid.

maxbook:rubinius max$ locale
LANG="UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_CTYPE="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_ALL="ru_RU.UTF-8"
maxbook:rubinius max$ ./bin/mspec spec/ruby/1.8/core/time/at_spec.rb
Started
F..

1)
Time.at converts to time object FAILED
Expected "Thu Jan 11 03:38:44 +0200 2007"
to equal "\321\207\321\202 \321\217\320\275\320\262 11 03:38:44 +0200 2007": 
          Expectation.fail_with at ./mspec/expectations.rb:10
     PositiveOperatorMatcher#== at ./mspec/matchers/base.rb:8
             main.__script__ {} at ./spec/ruby/1.8/core/time/at_spec.rb:7
                      Proc#call at kernel/core/proc.rb:66
         SpecRunner#describe {} at ./mspec/runner/runner.rb:147
                     Array#each at kernel/core/array.rb:557
            SpecRunner#describe at ./mspec/runner/runner.rb:156
                Object#describe at ./mspec/runner/object.rb:11
                main.__script__ at ./spec/ruby/1.8/core/time/at_spec.rb:4
       CompiledMethod#as_script at kernel/core/compiled_method.rb:206
            Compile.single_load at kernel/core/compile.rb:203
        Compile.unified_load {} at kernel/core/compile.rb:127
                     Array#each at kernel/core/array.rb:557
           Compile.unified_load at kernel/core/compile.rb:107
            Kernel(Object)#load at kernel/core/compile.rb:358
             main.__script__ {} at tmp/last_mspec.rb:15
                     Array#each at kernel/core/array.rb:557
                main.__script__ at tmp/last_mspec.rb:20
       CompiledMethod#as_script at kernel/core/compiled_method.rb:206
            Compile.single_load at kernel/core/compile.rb:203
    Compile.load_from_extension at kernel/core/compile.rb:281
                main.__script__ at kernel/loader.rb:176

Finished in 0.018671 seconds

3 examples, 3 expectations, 1 failure, 0 errors

maxbook:rubinius max$

Comments and changes to this ticket

  • Dirkjan Bussink

    Dirkjan Bussink January 28th, 2008 @ 02:27 AM

    • → State changed from “new” to “open”

    We need to enforce a C or EN-US locale when the specs are ran. Working correctly in every locale for the specs is simply not feasible. We try to spec rubinius, not locales :).

  • Pierre Yager

    Pierre Yager January 29th, 2008 @ 02:12 PM

    • → Title changed from “[BUG] ruby/1.8/core/time/at_spec.rb fails with russian locale” to “[PATCH] ruby/1.8/core/time/at_spec.rb fails with russian locale”

    I patched this one adding LC_ALL="C" before call to the `date` system command on linux.

    Now bin/ci completes with some failures related to 64 bits ports but not related to locale definitions.

    The patch is included (thanks to #rubinius and rue for the hint)

  • Eero Saynatkari

    Eero Saynatkari January 30th, 2008 @ 08:39 PM

    We need to figure out if using LC_ALL or setlocale() is portable enough to enable generally. No need to just enable this for Linux.

  • Eero Saynatkari

    Eero Saynatkari January 31st, 2008 @ 01:44 PM

    • → State changed from “open” to “resolved”

    Committed as 26059c15, thanks! Reference that commit hash and this ticket number with evan. I made a second commit to add it for all platforms for now. If it breaks somewhere, we will revisit.

  • Eero Saynatkari

    Eero Saynatkari May 5th, 2008 @ 03:31 AM

    • → Assigned user changed from “” to “Eero Saynatkari”
    • → Title changed from “[PATCH] ruby/1.8/core/time/at_spec.rb fails with russian locale” to “[BUG] ruby/1.8/core/time/at_spec.rb fails with russian locale”

    Old ticket, closed.

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »