Bug #3891

Unexpected result of ENV[""] on Windows

Added by Heesob Park over 4 years ago. Updated about 4 years ago.

[ruby-core:32650]
Status:Closed
Priority:Low
Assignee:-
ruby -v:ruby 1.9.3dev (2010-09-29 trunk 29366) [i386-mswin32_90] Backport:

Description

=begin
I noticed that ENV[""] returns "::=::\" on Windows.

This bug exists almost all versions of ruby from 1.8.x to 1.9.x

C:>ruby -ve 'p ENV[""]'
ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]
"::=::\"

C:\work>ruby -ve 'p ENV[""]'
ruby 1.9.3dev (2010-09-29 trunk 29366) [i386-mswin32_90]
"::=::\"

Here is a simple patch:

--- win32.c 2010-09-30 15:13:59.000000000 +0900
+++ win32.c.new 2010-09-30 15:16:31.000000000 +0900
@@ -3900,6 +3900,7 @@
int len = strlen(name);
char *env;

  • if (len==0) return NULL; if (envarea) FreeEnvironmentStrings(envarea); envarea = GetEnvironmentStrings(); =end

History

#1 Updated by Usaku NAKAMURA over 4 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r29378.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF