MantisBT - CMake
View Issue Details
0009747CMakeCMakepublic2009-10-20 15:252011-06-06 18:25
Kevin Burge 
Bill Hoffman 
normalminoralways
closedfixed 
CMake-2-8 
CMake-2-8 
0009747: $ENV{} unhandled win32 exception on Windows
test.cmake:
set (ENV{TEST} "test:$ENV{}")

cmake -P test.cmake

causes the exception.
No tags attached.
patch 9747.patch (901) 2009-10-22 00:05
https://public.kitware.com/Bug/file/2583/9747.patch
patch 9747_2.patch (1,050) 2009-10-22 00:09
https://public.kitware.com/Bug/file/2584/9747_2.patch
Issue History
2009-10-20 15:25Kevin BurgeNew Issue
2009-10-20 15:34Bill HoffmanStatusnew => assigned
2009-10-20 15:34Bill HoffmanAssigned To => Bill Hoffman
2009-10-22 00:05Kevin BurgeFile Added: 9747.patch
2009-10-22 00:07Kevin BurgeNote Added: 0018161
2009-10-22 00:09Kevin BurgeFile Added: 9747_2.patch
2009-10-22 00:10Kevin BurgeNote Added: 0018162
2009-10-22 09:43Bill HoffmanNote Added: 0018177
2011-02-03 18:04David ColeStatusassigned => resolved
2011-02-03 18:04David ColeFixed in Version => CMake-2-8
2011-02-03 18:04David ColeResolutionopen => fixed
2011-06-06 18:25David ColeStatusresolved => closed
2011-06-06 18:25David ColeNote Added: 0026687

Notes
(0018161)
Kevin Burge   
2009-10-22 00:07   
I don't know if the patch is correct, but it does fix the test case. Is ${}, $ENV{}, or $CACHE{} ever actually valid without a variable name?
(0018162)
Kevin Burge   
2009-10-22 00:10   
Just realized that the my patch was checking for var and using key before key was checked. Second patch fixes, and adds an optimization.
(0018177)
Bill Hoffman   
2009-10-22 09:43   
I already checked this in:


Log Message:
Fix seg fault for empty ENV{} call bug 0009747


Index: cmCommandArgumentParserHelper.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCommandArgumentParserHelper.cxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -C 2 -d -r1.24 -r1.25
*** cmCommandArgumentParserHelper.cxx 28 Sep 2009 15:41:57 -0000 1.24
--- cmCommandArgumentParserHelper.cxx 21 Oct 2009 13:04:50 -0000 1.25
***************
*** 66,70 ****
      {
      return this->ExpandVariable(var);
! }
    if ( strcmp(key, "ENV") == 0 )
      {
--- 66,74 ----
      {
      return this->ExpandVariable(var);
! }
! if(!var)
! {
! return this->EmptyVariable;
! }
    if ( strcmp(key, "ENV") == 0 )
      {
(0026687)
David Cole   
2011-06-06 18:25   
Closing resolved issues that have not been updated in more than 3 months.