The following issue has been SUBMITTED. ====================================================================== http://public.kitware.com/Bug/view.php?id=14928 ====================================================================== Reported By: dirk-thomas Assigned To: ====================================================================== Project: CMake Issue ID: 14928 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2014-05-22 15:01 EDT Last Modified: 2014-05-22 15:01 EDT ====================================================================== Summary: cmake -E create_symlink always returns code 0 even when failing to create symlink Description: When invoking the command "cmake -E create_symlink old new" the return code is always 0 even when the command failed to create the symlink.
Steps to Reproduce: Invoke "cmake ." with the following CMakeLists.txt file in the same folder to reproduce: # create a real file set(file "${CMAKE_CURRENT_SOURCE_DIR}/test") file(WRITE "${file}" "foo") if(EXISTS "${file}" AND NOT IS_SYMLINK "${file}") message(STATUS "OK: it is a file, not a symlink") else() message(FATAL_ERROR "ups, this hould not happen") endif() # try to create a symlink execute_process( COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink" "/tmp/somewhere" "${file}" RESULT_VARIABLE rc OUTPUT_VARIABLE output ERROR_VARIABLE error ) message(STATUS "RESULT_VARIABLE ${rc}") message(STATUS "OUTPUT_VARIABLE ${output}") message(STATUS "ERROR_VARIABLE ${error}") if(EXISTS "${file}" AND IS_SYMLINK "${file}") message(STATUS "WEIRD: it is a symlink, not a file, has overwritten the existing file") elseif(NOT rc EQUAL 0) message(STATUS "OK: could not create symlink and returned error code") else() message(FATAL_ERROR "ups, this hould not happen, not creating the symlink but returning code 0 pretending it was successful") endif() Additional Information: I currently manually have to check that neither a symlink nor file is present before invoking the command and check afterwards that the symlink is present. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2014-05-22 15:01 dirk-thomas New Issue ====================================================================== -- 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/cgi-bin/mailman/listinfo/cmake-developers