[cmake-developers] [CMake 0014713]: cmake -create-symlink doesn't overwrite existing dangling(!) symlinks

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 20 11:06:58 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14713 
====================================================================== 
Reported By:                Alex
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14713
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-01-20 17:06 CET
Last Modified:              2014-01-20 17:06 CET
====================================================================== 
Summary:                    cmake -create-symlink doesn't overwrite existing
dangling(!) symlinks
Description: 
Calling create_symlink for an existing target file doesn't replace the link.

Assuming there are no files "Target1" nor "Target2" in the current directory
cmake -E create_symlink Target1 Link
cmake -E create_symlink Target2 Link

should leave a link 
Link -> Target2

but the result is
Link -> Target1

If 'Target1' exists, before calling the second "create_symlink", the behaviour
is correct and results in 'Link -> Target2'

And yes, I have a use case, where I want to have a dangling symlink ;-)



Steps to Reproduce: 
See description.

Additional Information: 
See in cmake.cxx, where the case 'args[1] == "create_symlink"' is handled. Looks
correct on the first sight, but:

most likely 'cmSystemTools::FileExists(destinationFileName)' doesn't return true
for a dangling symlink 'destinationFileName', and therefore after the first 'if'
statement the following code leading to
'!cmSystemTools::RemoveFile(destinationFileName)' isn't executed.

Solution: distinguish correctly for symlinks, whether link or targed doesn't
exist.

Or: remove the file 'destinationFileName' unconditionally.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-01-20 17:06 Alex           New Issue                                    
======================================================================



More information about the cmake-developers mailing list