Project

General

Profile

Actions

Bug #12949

closed

Loading rbconfig.rb fails if it contains non-ASCII characters and -K is specified

Added by shugo (Shugo Maeda) over 7 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:78181]

Description

TestRubyOptions#test_kanji fails on icc-x64 chkbuild.

From http://rubyci.org/logs/rubyci.s3.amazonaws.com/icc-x64/ruby-trunk/log/20161117T010002Z.fail.html.gz:

  1) Failure:
TestRubyOptions#test_kanji [/home/chkbuild/chkbuild/tmp/build/20161117T010002Z/ruby/test/ruby/test_rubyoptions.rb:143]:

1. [1/2] Assertion for "stdout"
   | <["EUC-JP"]> expected but was
   | <[]>.

2. [2/2] Assertion for "stderr"
   | <[]> expected but was
   | <["/home/chkbuild/chkbuild/tmp/build/20161117T010002Z/ruby/rbconfig.rb:279:in `gsub': invalid byte sequence in EUC-JP (ArgumentError)",
   |  "\tfrom /home/chkbuild/chkbuild/tmp/build/20161117T010002Z/ruby/rbconfig.rb:279:in `expand'",
   |  "\tfrom /home/chkbuild/chkbuild/tmp/build/20161117T010002Z/ruby/rbconfig.rb:297:in `block in <module:RbConfig>'",
   |  "\tfrom /home/chkbuild/chkbuild/tmp/build/20161117T010002Z/ruby/rbconfig.rb:296:in `each_value'",
   |  "\tfrom /home/chkbuild/chkbuild/tmp/build/20161117T010002Z/ruby/rbconfig.rb:296:in `<module:RbConfig>'",
   |  "\tfrom /home/chkbuild/chkbuild/tmp/build/20161117T010002Z/ruby/rbconfig.rb:10:in `<top (required)>'",
   |  "\tfrom /home/chkbuild/chkbuild/tmp/build/20161117T010002Z/ruby/lib/rubygems.rb:9:in `require'",
   |  "\tfrom /home/chkbuild/chkbuild/tmp/build/20161117T010002Z/ruby/lib/rubygems.rb:9:in `<top (required)>'",
   |  "\tfrom <internal:gem_prelude>:4:in `require'",
   |  "\tfrom <internal:gem_prelude>:4:in `<internal:gem_prelude>'"]>.

This is because RbConfig::CONFIG["CC_VERSION_MESSAGE"] contains non-ASCII characters,
and can be fixed by adding a magic comment to rbconfig.rb.

But which encoding should be specified?

Possible options are:

  1. ASCII-8BIT. It's reasonable when we can't know the correct encoding,
    but there may be compatibility issues.
  2. UTF-8. UTF-8 is the default source encoding, so there is no compatibility issue
    because the current behavior when -K is specified is a run-time error.
  3. The encoding of the locale at the time when ruby is compiled.
Actions #1

Updated by shugo (Shugo Maeda) over 7 years ago

  • Status changed from Open to Closed

Applied in changeset r56817.


mkconfig.rb: add a magic comment to rbconfig.rb

  • tool/mkconfig.rb: add a magic comment to rbconfig.rb in case the command
    line option -K is specified. [ruby-core:78181] [Bug #12949]

Updated by shugo (Shugo Maeda) over 7 years ago

ASCII-8BIT is suggested by naruse-san.

Actions

Also available in: Atom PDF

Like0
Like0Like0