Project

General

Profile

Actions

Bug #3891

closed

Unexpected result of ENV[""] on Windows

Added by phasis68 (Heesob Park) about 14 years ago. Updated over 13 years ago.

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

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
Actions

Also available in: Atom PDF

Like0
Like0