From: Usaku NAKAMURA Date: 2011-06-29T15:52:52+09:00 Subject: [ruby-core:37656] [Ruby 1.9 - Bug #1679] rb_w32_getenv() invalidates previous environment pointers Issue #1679 has been updated by Usaku NAKAMURA. In current trunk (at least), this problem is not occurred. The return value of getenv("RUBY_LIB") is rb_str_new()'ed before another getenv() call. ---------------------------------------- Bug #1679: rb_w32_getenv() invalidates previous environment pointers http://redmine.ruby-lang.org/issues/1679 Author: Jarek Jurasz Status: Assigned Priority: Normal Assignee: Akio Tajima Category: core Target version: 1.9.3 ruby -v: ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] =begin On Windows turning on page heap (gflags -p /enable ruby.exe /full) revealed that environment pointers returned by rb_w32_getenv() get invalidated on the next call to this function due to the freeing of the environment buffer. In particular getenv("RUBYLIB_PREFIX") in rubylib_mangle() frees getenv("RUBYLIB") fetched in ruby_init_loadpath(). This bug is also present in ruby 1.9.1-p129. The workaround - the RTL version of getenv() - worked fine for me so far. =end -- http://redmine.ruby-lang.org