View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009014CMakeCMakepublic2009-05-13 09:082016-06-10 14:30
ReporterHugo Heden 
Assigned ToBill Hoffman 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0009014: CMake hangs if error occurs in WHILE-loop
DescriptionThe following makes cmake hang in some infinite loop? (instead of just terminating with an error as would be expected)


File Script.cmake:
---------------
SET( Idx 0 )
WHILE( Idx LESS 1 )
  MESSAGE( FATAL_ERROR "Error -- exiting" )
  MATH( EXPR Idx ${Idx}+1 )
ENDWHILE( Idx LESS 1 )

---------------

$ cmake -P Script.cmake
-- Hello..
CMake Error at Script.cmake:12 (MESSAGE):
  Error -- exiting

 ...
 ... (cmake never terminates, eating 100% CPU)

----------

Tested on many platforms with 2.6.2, 2.6.3, 2.6.4.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0017439)
Bill Hoffman (manager)
2009-09-14 12:46

$ ../CMake-build26/bin/cmake -P foo.cmake
CMake Error at foo.cmake:4 (MESSAGE):
  Error -- exiting


Works for me??
(0017492)
Hugo Heden (reporter)
2009-09-14 17:39

Bill, thanks for taking a look at this.

The original report is admittedly somewhat obscure, but as I am running the sample program now it seems it is still valid.

What happens is this:

At the terminal prompt, I type:
 $cmake -P Script.cmake

The script outputs the error message. Once. So far all is fine. But then the script does not finish, which would have been expected -- it just hangs! And eats 100% CPU.

I am currently on Ubuntu Linux 9.04 (see version info below). When the original bug report was filed, I also had access to SGI-systems, as well as MS Windows.

$ cmake --version
cmake version 2.6-patch 2

$ uname -a
Linux <hostname> 2.6.28-15-generic #49-Ubuntu SMP Tue Aug 18 18:40:08 UTC 2009 i686 GNU/Linux

The script reproducing the error could be written like this:

--------------------------------
SET( Idx 0 )
WHILE( Idx LESS 1 )
 MESSAGE( FATAL_ERROR "Hello..?" )
ENDWHILE( Idx LESS 1 )
----------------------------------

Can anybody reproduce this?
(0017503)
Bill Hoffman (manager)
2009-09-14 20:39

Can you try cmake 2.6.4? or CVS CMake?
(0017527)
Hugo Heden (reporter)
2009-09-15 07:17

Yes, the behaviour is still there with 2.6.4.

If there's a Nightly Build binary from last night I can download I can test with that too.
(0018242)
tyler (reporter)
2009-10-26 14:49

This bug is affecting me. I'm using CMake 2.6.2 on Ubuntu 8.04. I see everything that Hugo reported: script says it's exiting but never does, cmake uses 100% of cpu.

I can add that, according to strace, cmake isn't doing anything when it gets in this state:

write(2, "CMake Error at CMakeLists.txt:29"..., 103CMake Error at CMakeLists.txt:29 (message):
  Arrived at / but never found a product root. Aborting.

) = 103
write(2, "\n", 1
) = 1

and then it just sits there forever.

Is there any work around? Instead of failing immediately, I guess I can invalidate my while() condition, set a variable LOOP_FAILED, and then message(FATAL_ERROR ...) at the end, but that's obviously ugly.
(0018244)
Modestas Vainius (reporter)
2009-10-26 17:35

Reproducible with 2.6.4, unreproducible with 2.8.0-rc3.
(0018246)
Hugo Heden (reporter)
2009-10-26 18:32

Thanks guys for confirming. I thought I was alone in the whole world seeing this, which is always a bit discomforting...

As suggested by MoDaX, this seems to be fixed in cmake-2.8.0-rc3-Linux-i386 (so closing this issue would be perfectly fine by me)
(0041558)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2009-05-13 09:08 Hugo Heden New Issue
2009-09-14 12:46 Bill Hoffman Note Added: 0017439
2009-09-14 12:46 Bill Hoffman Status new => assigned
2009-09-14 12:46 Bill Hoffman Assigned To => Bill Hoffman
2009-09-14 17:39 Hugo Heden Note Added: 0017492
2009-09-14 20:39 Bill Hoffman Note Added: 0017503
2009-09-15 07:17 Hugo Heden Note Added: 0017527
2009-10-26 14:49 tyler Note Added: 0018242
2009-10-26 17:35 Modestas Vainius Note Added: 0018244
2009-10-26 18:32 Hugo Heden Note Added: 0018246
2016-06-10 14:27 Kitware Robot Note Added: 0041558
2016-06-10 14:27 Kitware Robot Status assigned => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:30 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team