Bug #1757
cygwin-1.7, gcc4-4.3, and ruby-1.9. method `inspect' called on hidden object (0x10046720) (NotImplementedError)
| Status: | Closed | Start date: | 07/10/2009 | |
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | - | |||
| Target version: | 1.9.2 | |||
| ruby -v: | ruby 1.9.2dev (2009-07-10 trunk 24017) [i386-cygwin] |
Description
I tried compiling ruby-1.9.2-r24017 on cygwin-1.7.0 using gcc-4.3 as follows:
$ cygcheck -f /bin/cygwin1.dll /usr/bin/gcc-4
cygwin-1.7.0-50
gcc4-core-4.3.2-2
$ ../ruby-1.9.2-r24017/configure --program-suffix="-19" --with-ridir="/usr/share/ri-19" CC="gcc-4" CFLAGS="-O2 -pipe -DCCP_WIN_A_TO_POSIX=CCP_WIN_A_TO_POSIX"
$ make
The -DCCP_WIN_A_TO_POSIX=CCP_WIN_A_TO_POSIX above was added to make use of the #if switch introduced in r23468 to skip a deprecated function in cygwin 1.7(, and is not related to the issue that follows). Then,
$ ./miniruby.exe -v -e 'p($:)'
ruby 1.9.2dev (2009-07-10 trunk 24017) [i386-cygwin]
-e:1:in `inspect': method `inspect' called on hidden object (0x100466f8) (NotImplementedError)
from -e:1:in `p'
from -e:1:in `<main>'
$ ./miniruby.exe -e 'puts($-I)'
-e:1:in `puts': method `respond_to?' called on hidden object (0x100466f8) (NotImplementedError)
from -e:1:in `puts'
from -e:1:in `<main>'
So, $:, $-I, and $LOAD_PATH seem to be hidden objects, somehow.
Associated revisions
* ruby.c (ruby_init_loadpath_safe): should not dup tmp string. a
patch from neomjp neomjp in [ruby-core:24251].
History
Updated by yugui (Yuki Sonoda) almost 3 years ago
- Priority changed from Normal to High
- Target version set to 1.9.2
Updated by yugui (Yuki Sonoda) almost 3 years ago
- Assignee set to nobu (Nobuyoshi Nakada)
Updated by neomjp (neomjp neomjp) almost 3 years ago
I was wrong in presuming that -DCCP_WIN_A_TO_POSIX=CCP_WIN_A_TO_POSIX was not related.
1. ../ruby-1.9.2-r24220/configure --program-suffix="-19" --with-ridir="/usr/share/ri-19" CC="gcc-4"
2. Edit Makefile so that
CFLAGS = ${cflags} -DCCP_WIN_A_TO_POSIX=CCP_WIN_A_TO_POSIX
3. make
$ ./miniruby.exe -ve "p($:)";
ruby 1.9.2dev (2009-07-21 trunk 24220) [i386-cygwin]
-e:1:in `inspect': method `inspect' called on hidden object (0x10046658) (NotImplementedError)
from -e:1:in `p'
from -e:1:in `<main>'
Something about #define BASEPATH() in r23468 seemed to be related to this issue. The correct behavior could be recovered by using rb_str_buf_cat() instead of rb_str_dup() in case #if !VARIABLE_LIBPATH is false. But I am not sure if it is the right way to fix it. Can anybody verify this?
--- src/ruby-1.9.2-r24220/ruby.c 2009-06-23 01:21:09.000000000 +0900
+++ newsrc/ruby-1.9.2-r24220/ruby.c 2009-07-22 22:00:18.282555100 +0900
@@ -350,8 +363,8 @@ ruby_init_loadpath_safe(int safe_level)
VALUE sopath;
# else
char libpath[MAXPATHLEN + 1];
- size_t baselen;
# endif
+ size_t baselen;
char *p;
#if defined _WIN32 || defined __CYGWIN__
@@ -414,15 +427,13 @@ ruby_init_loadpath_safe(int safe_level)
p = libpath + 1;
}
- baselen = p - libpath;
-
-#define BASEPATH() rb_str_buf_cat(rb_str_buf_new(baselen+len), libpath, baselen)
#else
rb_str_set_len(sopath, p - libpath);
-#define BASEPATH() rb_str_dup(sopath)
#endif
+ baselen = p - libpath;
+#define BASEPATH() rb_str_buf_cat(rb_str_buf_new(baselen+len), libpath, baselen)
#define RUBY_RELATIVE(path, len) rb_str_buf_cat(BASEPATH(), path, len)
#else
#define RUBY_RELATIVE(path, len) rubylib_mangled_path(path, len)
$ ./miniruby.exe -ve "p($:)";
ruby 1.9.2dev (2009-07-21 trunk 24220) [i386-cygwin]
["/tmp/ruby19/ruby19-1.9.2devr24220-0/build/lib/ruby/site_ruby/1.9.1", "/tmp/ruby19/ruby19-1.9.2devr24220-0/build/lib/ruby/site_ruby/1.9.1/i386-cygwin", "/tmp/ruby19/ruby19-1.9.2devr24220-0/build/lib/ruby/site_ruby", "/tmp/ruby19/ruby19-1.9.2devr24220-0/build/lib/ruby/vendor_ruby/1.9.1", "/tmp/ruby19/ruby19-1.9.2devr24220-0/build/lib/ruby/vendor_ruby/1.9.1/i386-cygwin", "/tmp/ruby19/ruby19-1.9.2devr24220-0/build/lib/ruby/vendor_ruby", "/tmp/ruby19/ruby19-1.9.2devr24220-0/build/lib/ruby/1.9.1", "/tmp/ruby19/ruby19-1.9.2devr24220-0/build/lib/ruby/1.9.1/i386-cygwin"]
Updated by nobu (Nobuyoshi Nakada) over 2 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r25390. neomjp, thank you for your reporting of the issue. You have greatfully contributed toward Ruby. May Ruby be with you.