From: "Юрий Соколов" Date: 2013-03-29T20:39:40+09:00 Subject: [ruby-core:53821] Re: [ruby-trunk - Bug #8165] Problems with require --047d7bfcf274da1a4804d90eb920 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable May be it will be simpler to accept https://bugs.ruby-lang.org/issues/8158 = ? It has less memory requirement, avoids string comparisons, etc (yes, i'm annoying a bit, sorry) 2013/3/29 h.shirosaki (Hiroshi Shirosaki) > > Issue #8165 has been updated by h.shirosaki (Hiroshi Shirosaki). > > File 0001-load.c-fix-require-with-non-ascii-path.patch added > > One more issue seems string encoding. > When looking up a feature name in rb_feature_p(), encoding information > lacks. > So `short_feature' should not have encoding. > If encoding of the two non-ascii strings is different, hash value would b= e > different. > > load.c: rb_feature_p() > > feature_val =3D rb_str_new(feature, len); // not have encoding > > this_feature_index =3D rb_hash_lookup(features_index, feature_val); > > > I've attached a patch. Tested on both trunk and 2.0.0 branch. > > ruby 2.1.0dev (2013-03-29 trunk 39991) [x86_64-linux] > ruby 2.0.0p100 (2013-03-27 revision 39954) [x86_64-linux] > ---------------------------------------- > Bug #8165: Problems with require > https://bugs.ruby-lang.org/issues/8165#change-38028 > > Author: Krugloff (Alexandr Kruglov) > Status: Assigned > Priority: Normal > Assignee: tarui (Masaya Tarui) > Category: > Target version: current: 2.1.0 > ruby -v: ruby 2.0.0-p0 > > > Require doesn't work correctly if path contains cyrillic. > > require '/home/mak/test.rb' #-> true > require '/home/mak/test.rb' #-> false > > require '/home/mak/=F0=D2=CF=C5=CB=D4=D9/test.rb' #-> true > require '/home/mak/=F0=D2=CF=C5=CB=D4=D9/test.rb' #-> true > > > -- > http://bugs.ruby-lang.org/ > > --047d7bfcf274da1a4804d90eb920 Content-Type: text/html; charset=KOI8-R Content-Transfer-Encoding: quoted-printable
May be it will be simpler to accept=9Ahttps://bugs.ruby-lang.= org/issues/8158=9A? It has less memory requirement, avoids string compa= risons, etc

(yes, i'm annoying a bit, sorry)
<= div class=3D"gmail_extra">

2013/3/29 h.sh= irosaki (Hiroshi Shirosaki) <h.shirosaki@gmail.com>

Issue #8165 has been updated by h.shirosaki (Hiroshi Shirosaki).

File 0001-load.c-fix-require-with-non-ascii-path.patch added

One more issue seems string encoding.
When looking up a feature name in rb_feature_p(), encoding information lack= s.
So `short_feature' should not have encoding.
If encoding of the two non-ascii strings is different, hash value would be = different.

load.c: rb_feature_p()

=9A =9A feature_val =3D rb_str_new(feature, len); // not have encoding

=9A =9A this_feature_index =3D rb_hash_lookup(features_index, feature_val);=


I've attached a patch. Tested on both trunk and 2.0.0 branch.

ruby 2.1.0dev (2013-03-29 trunk 39991) [x86_64-linux]
ruby 2.0.0p100 (2013-03-27 revision 39954) [x86_64-linux]
----------------------------------------
Bug #8165: Problems with require
https://bugs.ruby-lang.org/issues/8165#change-38028

Author: Krugloff (Alexandr Kruglov)
Status: Assigned
Priority: Normal
Assignee: tarui (Masaya Tarui)
Category:
Target version: current: 2.1.0
ruby -v: ruby 2.0.0-p0


Require doesn't work correctly if path contains cyrillic.

require '/home/mak/test.rb' #-> true
require '/home/mak/test.rb' #-> false

require '/home/mak/=F0=D2=CF=C5=CB=D4=D9/test.rb' #-> true
require '/home/mak/=F0=D2=CF=C5=CB=D4=D9/test.rb' #-> true


--
http://bugs.ruby-l= ang.org/


--047d7bfcf274da1a4804d90eb920--