[CMake] cmake -E create_symlink for Windows

Michael Wild themiwi at gmail.com
Sat Dec 12 15:14:10 EST 2009


On 12. Dec, 2009, at 17:42 , Alan W. Irwin wrote:

> On 2009-12-12 09:44-0500 David Cole wrote:
> 
>> On Fri, Dec 11, 2009 at 10:04 AM, Michael Wild <themiwi at gmail.com> wrote:
>> Bummer. What where they THINKING??? (if at all...). It seems to me
>> that M$ just CAN'T get it right. No matter how many times they try,
>> how many good examples are out there, they always manage to seriously
>> screw something up... Come to think of it, they probably were thinking
>> about symlink-attacks...
>> Come on. Let's make a deal: you don't bash Microsoft, Apple or Google here
>> on the CMake mailing list and I won't bash Unix or Linux in any forum,
>> anywhere, ever. OK? Does that sound cool?

I beg your pardon?! I think just a little exasperation is in place here, especially I couldn't find any documentation on this apart from the page mentioned by Hendrik. What had me really surprised is the fact that http://msdn.microsoft.com/en-us/library/aa363866(VS.85).aspx doesn't say a word on the fact that the function will fail if the executing process doesn't have the SeCreateSymbolic right. My wording may have been a bit crude, for this I apologize. And I did mention a good reason for having this stringent policy (i.e. symlink attacks). Besides, if you feel like expressing your displeasure with Linux and Unix, please go ahead. After all, if nobody ever does so, how do you expect things to improve in the first place?

And referring to the Windows shortcuts: No, they are not equivalent, as they require special treatment and parsing. They are only work-alikes from the user point-of-view when he's interacting with them in the Explorer, or other software that implements the protocol. They are NOT transparent in the sense that if you write a piece of software that reads and writes to files, you don't have to care whether this actually is a shortcut or not.

> 
> Absolutely.  There used to be another poster here (before he got
> so-over-the-top that he was removed) that kept making gratuitous attacks on
> Linux and free software, and that was extremely annoying.  So as a Linux
> developer I support Dave's call to be aware of other's strong feelings
> and stay on topic so we don't waste a lot of time here.
> 

As I mentioned, I only expressed my disappointment that it won't be possible to implement -E create_symlink in any useful way on Windows, so yes, IMHO it was on topic. The waste of time comes into play if somebody spends considerable effort developing a build system using -E create_symlink on a non-Windows platform and then has to refactor the whole thing because he based the whole thing on wrong assumptions (refer to your post below).

[...]

> 
> Before this thread, I always assumed cmake -E commands gave you an excellent
> way to do common tasks in a cross-platform way.  I appeal to the CMake
> developers to avoid from now on implementing any more CMake -E commands that
> have no hope of ever fulfilling that mandate, Also, please deprecate and
> document the cmake -E commands with obvious cross-platform limitations
> because otherwise your users are going to assume (like I did) that those
> commands are the recommended way to help make their project cross-platform.
> Is create_symlink an isolated case, or are there other cmake -E commands to
> worry about?

I don't think it should be deprecated or removed, just for the simple reason that there is a lot of Unix-only software using CMake that can really profit from it. This also applies to other platform peculiarities. However, what definitely needs to be done, is to state the supported platforms very clearly in the documentation.

> 
> Also, is create_symlink really a lost cross-platform cause?  Reading later
> in Dave's post, it appears that the symlink concept does work on some
> Windows platform (he mentioned something about "shortcuts").  If there are
> intentions to make it work on a number of Windows platforms eventually, but
> that just hasn't happened yet, then _warn_ about that issue (e.g., something
> like "Unix-only for now" in the documentation).  Also, if the CMake -E
> command is run on a platform that doesn't support it something better than a
> silent failure should be the result.

As I said, "shortcuts" are only "poor man's" substitutes for symlinks. Essentially, they are files with a .lnk extension that contain the shortcut destination. In as such they are not THAT different from most symlink implementations. The difference is, that they are not part of the file system and that the programmer needs to deal with them manually. Refer to http://msdn.microsoft.com/en-us/library/bb776891(VS.85).aspx to get an impression of how tedious that is.

Again, I'm sorry if I offended any of you, that was not my intention. But I also hope that you understand some of my exasperation.

Michael


More information about the CMake mailing list