View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014713CMakeCMakepublic2014-01-20 11:062016-02-16 18:12
ReporterAlex Rettig 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSOS Version
Product Version 
Target VersionCMake 3.0Fixed in VersionCMake 3.0 
Summary0014713: cmake -create-symlink doesn't overwrite existing dangling(!) symlinks
DescriptionCalling 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 ReproduceSee description.
Additional InformationSee 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.
TagsNo tags attached.
Attached Files

 Relationships
related to 0004418closedSystem Admin cmake -create-symlink doesn't overwrite existing symlinks 
related to 0014928closed cmake -E create_symlink always returns code 0 even when failing to create symlink 

  Notes
(0034974)
Alex Rettig (reporter)
2014-01-20 11:10
edited on: 2014-01-20 11:11

Issue 0004418 dealt with the issue of overwriting symlinks already, but obviously didn't catch this cornercase.

(0034982)
Brad King (manager)
2014-01-21 08:54

I've committed a fix and new test cases to cover this:

 cmake: Improve '-E create_symlink' edge case handling
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e0228e2b [^]
(0035929)
Alex Rettig (reporter)
2014-05-26 06:19

Thanks, Brad, I double checked with a freshly pulled version from today, found all variants I tested working correctly.

 Issue History
Date Modified Username Field Change
2014-01-20 11:06 Alex Rettig New Issue
2014-01-20 11:10 Alex Rettig Note Added: 0034974
2014-01-20 11:11 Alex Rettig Note Edited: 0034974
2014-01-20 11:17 Brad King Relationship added related to 0004418
2014-01-20 13:54 Brad King Assigned To => Brad King
2014-01-20 13:54 Brad King Status new => assigned
2014-01-20 13:54 Brad King Target Version => CMake 3.0
2014-01-21 08:54 Brad King Note Added: 0034982
2014-01-21 08:55 Brad King Status assigned => resolved
2014-01-21 08:55 Brad King Resolution open => fixed
2014-01-21 08:55 Brad King Fixed in Version => CMake 3.0
2014-05-23 13:39 Brad King Relationship added related to 0014928
2014-05-26 06:19 Alex Rettig Note Added: 0035929
2014-05-26 06:19 Alex Rettig Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team