Bug #14979
closedInvalid argument - ruby_setenv(SURVEY) (Errno::EINVAL)
Description
The error occurs with Ruby 2.5.1-2 (x64) on windows as well as with an old Ruby 1.9.3 (x86) on windows, when setting an environment variable:
ENV['SURVEY']="12345"
I am tested it on Windows 10.
The error seems to be triggered, when the environment is big. My environment has a lot of variables (about 400) and set > x.x
produces a file of about 34k. My PATH-variable is about 5k.
When I empty my PATH-variable (which also reduces the total environment) the error disappears.
I tried to recreate the issue on linux, but even a much bigger environment is no problem.
And Perl on Windows does not have this problem too.
Updated by shevegen (Robert A. Heiler) about 6 years ago
Interesting. My Linux-environment, in ruby via ENV, has 810 entries and
I have no problem.
How did you clear the PATH variable by the way?
ENV['PATH'] = ''
?
Do you think you could do a little testing, e. g. generate
some fake file for variables, then load this up before
e. g. entering IRB?
Perhaps the error has to do with PATH. I am of course just
guessing. Does your PATH happen to have any "" character
as such? I mention this because I know that even on Linux,
things can become sort of screwy.
Either way, I think the above error should not happen because
the moment you are in IRB or execute some .rb file, such an
error should not appear, in my opinion, since ruby should be
in full control of its "niche" on Windows (once it does
run).
It sounds a lot like a bug so it may be fixed quite quickly
once it is found out where the error is, which is why I think
it may help if you could isolate the problem a little - I
think there must be something in the environment variables
that causes things to be screwy; can you publish the PATH
variable with which things do not work here, if you can?
Or the minimal PATH that can reproduce the error for your
system.
Updated by nobu (Nobuyoshi Nakada) about 6 years ago
- Status changed from Open to Closed
Applied in changeset trunk|r64293.
hash.c: env block size limit on Windows
- hash.c (ruby_setenv): do not check environment block size.
c.f. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682653(v=vs.85).aspx
Starting with Windows Vista and Windows Server 2008, there is no
technical limitation on the size of the environment block.
[ruby-core:88400] [Bug #14979]
Updated by tvw (Thomas Volkmar Worm) about 6 years ago
shevegen (Robert A. Heiler) wrote:
Interesting. My Linux-environment, in ruby via ENV, has 810 entries and
I have no problem.
When you read my report carefully: the problem only occurs on windows. I was trying to recreate it on linux but without success.
zaphodbb