Bug #14979


Invalid argument - ruby_setenv(SURVEY) (Errno::EINVAL)

Added by tvw (Thomas Volkmar Worm) almost 4 years ago. Updated almost 4 years ago.

Target version:
ruby -v:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]


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:


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) almost 4 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

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

Actions #2

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r64293.

hash.c: env block size limit on Windows

Updated by tvw (Thomas Volkmar Worm) almost 4 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.



Also available in: Atom PDF