[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

jruby and case insensitive environment variables on win32

Martin DeMello

10/30/2007 1:14:00 AM

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

2 Answers

Charles Oliver Nutter

10/30/2007 3:53:00 AM

0

Martin DeMello wrote:
> 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/...

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

- Charlie

Bernard Kenik

10/30/2007 5:40:00 AM

0

On Oct 29, 11:52 pm, Charles Oliver Nutter <charles.nut...@sun.com>
wrote:
> Martin DeMello wrote:
> > 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/...
>
> 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.