[cmake-developers] [CMake 0013845]: CMake segfault if extra newline in link.txt

Mantis Bug Tracker mantis at public.kitware.com
Thu Jan 10 15:12:08 EST 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=13845 
====================================================================== 
Reported By:                rbmj
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13845
Category:                   (No Category)
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-01-10 15:12 EST
Last Modified:              2013-01-10 15:12 EST
====================================================================== 
Summary:                    CMake segfault if extra newline in link.txt
Description: 
The origin of this problem was that I was writing/testing a cross toolchain file
which made complicated custom link rules.  One of the variables in the link rule
came from an execute_process command that had a trailing newline and that,
because of its positioning, ended up adding a blank line in the link.txt.  This
causes cmake to segfault.

This may be rare enough that it's not an issue.  Also, I don't have the latest
and greatest CMake, so it may already be fixed...

Reproducing is easy though:

Steps to Reproduce: 
Make hello.c:

#include <stdio.h>
int main() {
   printf("Hello, World!\n");
   return 0;
}

and CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
project(hello)
add_executable(hello hello.c)

Go to build directory and run cmake.  Then, add a blank line to the beginning of
 CMakeFiles/hello.dir/link.txt

Run make:

...
Linking C executable hello
Error running link command: Segmentation fault
make[2]: *** [hello] Error 1
make[1]: *** [CMakeFiles/hello.dir/all] Error 2
make: *** [all] Error 2
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-01-10 15:12 rbmj           New Issue                                    
======================================================================




More information about the cmake-developers mailing list