From: "t3ch.dude" Date: 2009-12-03T01:15:07+09:00 Subject: Re: Rake Environment variables gone missing On Dec 1, 11:16 am, Herman Schultz wrote: > I posted this about six months ago but the form seems to have gone > missing. > > Unfortunately, I have been sent back to work on the project from hell > and am running into the same issue. > > The previous posts didn't produce much help as no one seems to be able > to produce the problem but me. > > I am running on windows-xp machine with ruby 1.8.6 (2008-08-11 > patchlevel 287) [i386-mswin32] and rake, version 0.8.1. > > Here's the issue.  I read in a windows batch file that has a bunch of > environment variable in it that are used in a hornets nest of Devstudio > C++ projects.  I want to parse the variables out and pass them to ENV so > I can invoke incredibuild from rake. > > Here's the problem code. > >  File.foreach env_batch_file do |line| >    if /^\s*SET\s*([^\s=]+)\s*=\s*(.*)$/i =~ line >       env_count = ENV.size() >       key = $1 >       value = resolve_variables($2) > >       key.strip! >       value.strip! >       already_has_key = ENV.has_key?(key) > >       ENV[key] = value.dup >       env_count = env_count + 1 > >       if( env_count != ENV.size()) >          if ( already_has_key ) >               verbose("Variable already set.", 5) >            else >               verbose("ENV Hash whacked." , 1) >          end >       end >    end > > In this particular manifestation of the problem it happens when the ENV > size grows to 360.  Here's some output: > > 360: > In Value = %IIE_SOURCE%\cen_xml_support\build\windows\static\release > Rep = F:\source\iie\trunk > Val = %IIE_SOURCE%\cen_xml_support\build\windows\static\release > Val = F:\source\iie\trunk\cen_xml_support\build\windows\static\release > No quotes. > Return -> > F:\source\iie\trunk\cen_xml_support\build\windows\static\release > 360:ENV[CEN_XML_SUPPORT_REL_LIB_LOC] = > F:\source\iie\trunk\cen_xml_support\build\windows\static\release > ENV Hash whacked. 360:361 -> CEN_XML_SUPPORT_REL_LIB_LOC > 360 > > I should note that in the very next attempt the size of ENV goes to 27! > So something is going seriously wrong here. > > Any thoughts as to what specifically is failing. > -- > Posted viahttp://www.ruby-forum.com/. Herman, I found one reference (http://blogs.msdn.com/oldnewthing/archive/ 2006/07/06/657868.aspx ) indicating that the Windows environment is limited to 64K, or 32Kcharacters in size. I'll bet you hit that limit. It probably broke for you where it worked for others because by resolving variables, you're increasing the size of the values. -T3ch.dude