I was caught by this infinite loop issue when attempting to build
Qt5.3.1 using ExternalProject.cmake. I used an MD5 sum value given by
BLFS for the Qt5.3.1 tar.gz download which happened to be the wrong
value. In my case the consequences were not too bad because I
was "downloading" from a local disk drive "URL". However, this
infinite loop could be construed as a denial-of-service attack
on some open-source project if an actual download keeps getting
repeated indefinitely. Note this bad retries logic in the downloads
was introduced after CMake-2.8.12.2, and a search of the bug tracker
for "infinite" shows nothing relevant.
See attached patch in "git format-patch" form that fixes the problem
for the CMake master branch.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
From 17411f5a33ae3451e45424566ac173eb8d49240d Mon Sep 17 00:00:00 2001
From: "Alan W. Irwin" <[email protected]>
Date: Mon, 8 Sep 2014 12:24:17 -0700
Subject: [PATCH] Fix infinite loop in file downloads if hash value not a
match
The issue was the attempt variable was not incremented in the while
loop.
---
Modules/ExternalProject.cmake | 1 +
1 file changed, 1 insertion(+)
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 218066c..b5d36ce 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -711,6 +711,7 @@ Retrying download.
file(REMOVE \"\${file}\")
execute_process(COMMAND \${CMAKE_COMMAND} -P \"${download_script}\")
endif()
+ math(EXPR attempt \"\${attempt} + 1\")
endwhile()
if(\${succeeded})
--
1.7.10.4
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers