[ruby-core:78181] [Ruby trunk Bug#12949] Loading rbconfig.rb fails if it contains non-ASCII characters and -K is specified

From: shugo@...
Date: 2016-11-17 04:24:03 UTC
List: ruby-core #78181
Issue #12949 has been reported by Shugo Maeda.

----------------------------------------
Bug #12949: Loading rbconfig.rb fails if it contains non-ASCII characters and -K is specified
https://bugs.ruby-lang.org/issues/12949

* Author: Shugo Maeda
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
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<non-UTF8 encoding> is specified is a run-time error.
3. The encoding of the locale at the time when ruby is compiled.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next