Issue #1757 has been updated by neomjp neomjp.


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"]

----------------------------------------
http://redmine.ruby-lang.org/issues/show/1757

----------------------------------------
http://redmine.ruby-lang.org