MantisBT - CMake
View Issue Details
0015987CMakeCMakepublic2016-02-25 09:062016-06-10 14:21
Tobias Hieta 
Brad King 
normalminoralways
closedfixed 
Apple MacOS X10.4.10
CMake 3.4.3 
CMake 3.6CMake 3.6 
0015987: STATUS variable to FILE(DOWNLOAD) does not consider HASH mismatch failures
This threw me for a bit of a loop when working with our cmake lists that download dependencies. It seems like the STATUS variable to file(download) only records errors if they happen when downloading the file. If the has mismatches the STATUS variable will still be set to 0 and "No error" as the error string. The only thing that does happen is that it prints a error message.

This makes it very hard to handle errors where the HASH is not correct since you can't use the status variable to abort the the processing like:

file(DOWNLOAD <url> STATUS DL_STATUS)
if(NOT DL_STATUS EQUAL 0)
  message(FATAL_ERROR "Failed")
endif()

I would expect the STATUS variable to be set to "1;HASH MISMATCH" or something when the has mismatches.
No tags attached.
patch set_file_download_status_on_hash_mismatch.patch (793) 2016-02-25 09:27
https://public.kitware.com/Bug/file/5633/set_file_download_status_on_hash_mismatch.patch
Issue History
2016-02-25 09:06Tobias HietaNew Issue
2016-02-25 09:27Tobias HietaFile Added: set_file_download_status_on_hash_mismatch.patch
2016-02-25 09:27Tobias HietaNote Added: 0040550
2016-02-25 11:45Brad KingNote Added: 0040552
2016-02-25 11:45Brad KingAssigned To => Brad King
2016-02-25 11:45Brad KingStatusnew => resolved
2016-02-25 11:45Brad KingResolutionopen => fixed
2016-02-25 11:45Brad KingFixed in Version => CMake 3.6
2016-02-25 11:45Brad KingTarget Version => CMake 3.6
2016-06-10 14:21Kitware RobotNote Added: 0041242
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0040550)
Tobias Hieta   
2016-02-25 09:27   
Uploaded a patch that makes it behave as I expect
(0040552)
Brad King   
2016-02-25 11:45   
Thanks. This should fix it:

 file(DOWNLOAD): Fill STATUS variable on hash mismatch
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6c9586f9 [^]
(0041242)
Kitware Robot   
2016-06-10 14:21   
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.