jruby and case insensitive environment variables on win32

M

Martin DeMello

When converting a Win32/Ruby application to JRuby, I ran into an
interesting quirk - the Windows Ruby interpreter (1.8.6 from the
one-click installer) let me "get away" with whatever mix of upper and
lower case I liked when accessing environment variables (e.g.
ENV['UserProfile'], ENV['userprofile'], ENV["USERPROFILE"], etc),
which is consistent with the way Windows itself does it. JRuby seems
to follow the Unix model where UserProfile and USERPROFILE are two
separate variables.

I raise this here rather than filing a bug with the JRuby team because
I am unsure as to what the correct behaviour is - are JRuby
environment variables a property of the JVM, and only incidentally a
property of the underlying operating system that the JVM picked them
up from, or should they accurately return the same results that MRI
would have?

martin
 
C

Charles Oliver Nutter

Martin said:
When converting a Win32/Ruby application to JRuby, I ran into an
interesting quirk - the Windows Ruby interpreter (1.8.6 from the
one-click installer) let me "get away" with whatever mix of upper and
lower case I liked when accessing environment variables (e.g.
ENV['UserProfile'], ENV['userprofile'], ENV["USERPROFILE"], etc),
which is consistent with the way Windows itself does it. JRuby seems
to follow the Unix model where UserProfile and USERPROFILE are two
separate variables.

I raise this here rather than filing a bug with the JRuby team because
I am unsure as to what the correct behaviour is - are JRuby
environment variables a property of the JVM, and only incidentally a
property of the underlying operating system that the JVM picked them
up from, or should they accurately return the same results that MRI
would have?

In JRuby, we pull in whatever the system provides as an environment, and
we don't do any magic to support case insensitivity. I'd like to know if
1.8.6 is doing something "extra" to support this or if it's just the way
environment variables work on win32.

FYI, it has already been reported as a bug, so don't worry about that.

http://jira.codehaus.org/browse/JRUBY-1441

Of course, if you'd like to try fixing it, we'd appreciate that too :)

- Charlie
 
B

bbiker

Martin said:
When converting a Win32/Ruby application to JRuby, I ran into an
interesting quirk - the Windows Ruby interpreter (1.8.6 from the
one-click installer) let me "get away" with whatever mix of upper and
lower case I liked when accessing environment variables (e.g.
ENV['UserProfile'], ENV['userprofile'], ENV["USERPROFILE"], etc),
which is consistent with the way Windows itself does it. JRuby seems
to follow the Unix model where UserProfile and USERPROFILE are two
separate variables.
I raise this here rather than filing a bug with the JRuby team because
I am unsure as to what the correct behaviour is - are JRuby
environment variables a property of the JVM, and only incidentally a
property of the underlying operating system that the JVM picked them
up from, or should they accurately return the same results that MRI
would have?

In JRuby, we pull in whatever the system provides as an environment, and
we don't do any magic to support case insensitivity. I'd like to know if
1.8.6 is doing something "extra" to support this or if it's just the way
environment variables work on win32.

FYI, it has already been reported as a bug, so don't worry about that.

http://jira.codehaus.org/browse/JRUBY-1441

Of course, if you'd like to try fixing it, we'd appreciate that too :)

- Charlie- Hide quoted text -

- Show quoted text -

Windows's environmental variables are case insensitive.

Hope's that helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top