MantisBT - CMake
View Issue Details
0009014CMakeCMakepublic2009-05-13 09:082016-06-10 14:30
Hugo Heden 
Bill Hoffman 
normalmajoralways
closedmoved 
CMake-2-6 
 
0009014: CMake hangs if error occurs in WHILE-loop
The 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.
No tags attached.
Issue History
2009-05-13 09:08Hugo HedenNew Issue
2009-09-14 12:46Bill HoffmanNote Added: 0017439
2009-09-14 12:46Bill HoffmanStatusnew => assigned
2009-09-14 12:46Bill HoffmanAssigned To => Bill Hoffman
2009-09-14 17:39Hugo HedenNote Added: 0017492
2009-09-14 20:39Bill HoffmanNote Added: 0017503
2009-09-15 07:17Hugo HedenNote Added: 0017527
2009-10-26 14:49tylerNote Added: 0018242
2009-10-26 17:35Modestas VainiusNote Added: 0018244
2009-10-26 18:32Hugo HedenNote Added: 0018246
2016-06-10 14:27Kitware RobotNote Added: 0041558
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0017439)
Bill Hoffman   
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   
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   
2009-09-14 20:39   
Can you try cmake 2.6.4? or CVS CMake?
(0017527)
Hugo Heden   
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   
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   
2009-10-26 17:35   
Reproducible with 2.6.4, unreproducible with 2.8.0-rc3.
(0018246)
Hugo Heden   
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   
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.