cmake -E create_symlink for Windows

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

cmake -E create_symlink for Windows

Marcel Loose
Hi all,

I was browsing the CMake sources for a problem I was facing with the
creation of symlinks (on Unix that is) and I noticed that the
SystemTools::CreateSymlink function simply returns false when building
on a Windows platform.

Does that mean that I cannot use 'cmake -E create_symlink' on Windows.
If that's the case I consider it a bug, because the documentation
suggests that 'cmake -E create_symlink' provides a platform independent
way of creating symbolic links. So, if the OS and/or filesystem does not
support symbolic links, IMHO, it should just copy the file.

Best regards,
Marcel Loose.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Michael Wild

On 11. Dec, 2009, at 14:27 , Marcel Loose wrote:

> Hi all,
>
> I was browsing the CMake sources for a problem I was facing with the
> creation of symlinks (on Unix that is) and I noticed that the
> SystemTools::CreateSymlink function simply returns false when building
> on a Windows platform.
>
> Does that mean that I cannot use 'cmake -E create_symlink' on Windows.
> If that's the case I consider it a bug, because the documentation
> suggests that 'cmake -E create_symlink' provides a platform independent
> way of creating symbolic links. So, if the OS and/or filesystem does not
> support symbolic links, IMHO, it should just copy the file.
>
> Best regards,
> Marcel Loose.
>

Simply copying the file might be just as bad if people assume it really IS a symlink... IMHO, if the OS can't create a symlink, cmake -E create_symlink should fail loudly, not just silently ignore it. And somebody should implement this function for Windows >= Vista/2008 (i.e. WINVER >= 0x0600):

http://msdn.microsoft.com/en-us/library/aa363866(VS.85).aspx

Michael
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Hendrik Sattler
Zitat von Michael Wild <[hidden email]>:

> On 11. Dec, 2009, at 14:27 , Marcel Loose wrote:
>> I was browsing the CMake sources for a problem I was facing with the
>> creation of symlinks (on Unix that is) and I noticed that the
>> SystemTools::CreateSymlink function simply returns false when building
>> on a Windows platform.
>>
>> Does that mean that I cannot use 'cmake -E create_symlink' on Windows.
>> If that's the case I consider it a bug, because the documentation
>> suggests that 'cmake -E create_symlink' provides a platform independent
>> way of creating symbolic links. So, if the OS and/or filesystem does not
>> support symbolic links, IMHO, it should just copy the file.
>
> Simply copying the file might be just as bad if people assume it  
> really IS a symlink... IMHO, if the OS can't create a symlink, cmake  
>  -E create_symlink should fail loudly, not just silently ignore it.  
> And somebody should implement this function for Windows >=  
> Vista/2008 (i.e. WINVER >= 0x0600):
>
> http://msdn.microsoft.com/en-us/library/aa363866(VS.85).aspx

For this, also see
   http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html
Please note the UAC dialog when creating symlink on Vista. Have fun,  
I'd say :-(

And what do you do on WindowsXP? What to do on FAT filesystems?
Additionally, without that extension above, it is non-obvious for  
Windows users that a specific file is a symbolic link.

HS


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Marcel Loose
In reply to this post by Marcel Loose
On Fri, 2009-12-11 at 14:51 +0100, Michael Wild wrote:

> On 11. Dec, 2009, at 14:27 , Marcel Loose wrote:
>
> > Hi all,
> >
> > I was browsing the CMake sources for a problem I was facing with the
> > creation of symlinks (on Unix that is) and I noticed that the
> > SystemTools::CreateSymlink function simply returns false when building
> > on a Windows platform.
> >
> > Does that mean that I cannot use 'cmake -E create_symlink' on Windows.
> > If that's the case I consider it a bug, because the documentation
> > suggests that 'cmake -E create_symlink' provides a platform independent
> > way of creating symbolic links. So, if the OS and/or filesystem does not
> > support symbolic links, IMHO, it should just copy the file.
> >
> > Best regards,
> > Marcel Loose.
> >
>
> Simply copying the file might be just as bad if people assume it really IS a symlink... IMHO, if the OS can't create a symlink, cmake -E create_symlink should fail loudly, not just silently ignore it. And somebody should implement this function for Windows >= Vista/2008 (i.e. WINVER >= 0x0600):
>
> http://msdn.microsoft.com/en-us/library/aa363866(VS.85).aspx
>
> Michael

Hi Michael,

I think it depends. Failing loudly may not always be desirable, just as
failing silently.

In my particular case, I was just creating a bunch of symlinks to
directories; no need to discern these symlinks from the actual
directories, but I need to be able to access the directory contents.

When it comes to symlinks to files, there may be situations where you
would really like it to be a link, e.g. when editing the file. Would
that be a CMake usage scenario??

I don't know what's the best way to deal with this issue. What do the
CMake developers think of this?

Best regards,
Marcel Loose.



_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Hendrik Sattler
In reply to this post by Hendrik Sattler
Zitat von Michael Wild <[hidden email]>:

> On 11. Dec, 2009, at 15:17 , Hendrik Sattler wrote:
>> Zitat von Michael Wild <[hidden email]>:
>>> On 11. Dec, 2009, at 14:27 , Marcel Loose wrote:
>>>> I was browsing the CMake sources for a problem I was facing with the
>>>> creation of symlinks (on Unix that is) and I noticed that the
>>>> SystemTools::CreateSymlink function simply returns false when building
>>>> on a Windows platform.
>>>>
>>>> Does that mean that I cannot use 'cmake -E create_symlink' on Windows.
>>>> If that's the case I consider it a bug, because the documentation
>>>> suggests that 'cmake -E create_symlink' provides a platform independent
>>>> way of creating symbolic links. So, if the OS and/or filesystem does not
>>>> support symbolic links, IMHO, it should just copy the file.
>>>
>>> Simply copying the file might be just as bad if people assume it    
>>> really IS a symlink... IMHO, if the OS can't create a symlink,  
>>> cmake  -E create_symlink should fail loudly, not just silently  
>>> ignore it.  And somebody should implement this function for  
>>> Windows >=  Vista/2008 (i.e. WINVER >= 0x0600):
>>>
>>> http://msdn.microsoft.com/en-us/library/aa363866(VS.85).aspx
>>
>> For this, also see
>>  http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html
>> Please note the UAC dialog when creating symlink on Vista. Have  
>> fun, I'd say :-(
>>
>> And what do you do on WindowsXP? What to do on FAT filesystems?
>> Additionally, without that extension above, it is non-obvious for  
>> Windows users that a specific file is a symbolic link.
>
> The UAC-thing only applies to directories where the user has no  
> write-acces (including the admin), right? So if you're half-way  
> sane, and build in a user-owned directory, you should be UAC-free...

To cite from that page:
  Vista and UAC

One of the major Vista changes was the so called User Account Control  
(UAC). Due to UAC some API calls need elevation to administrative  
level, and this elevation must be acknowledged via the below shown  
dialog box. Unfortunately, and I still can't believe this, the API  
call CreateSymbolicLink is a call, which needs elevation, and thus  
causes this annoying dialog box come up every time a symbolic link is  
created.


So, no, every time, even on own directories. I don't currently use  
Vista or Windows7, though. Also read the rest of that part of the  
page: cmake should not use functions directly that need elevation.

HS

PS: added list back


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

David Cole
In reply to this post by Marcel Loose
On Fri, Dec 11, 2009 at 9:18 AM, Marcel Loose <[hidden email]> wrote:
On Fri, 2009-12-11 at 14:51 +0100, Michael Wild wrote:
> On 11. Dec, 2009, at 14:27 , Marcel Loose wrote:
>
> > Hi all,
> >
> > I was browsing the CMake sources for a problem I was facing with the
> > creation of symlinks (on Unix that is) and I noticed that the
> > SystemTools::CreateSymlink function simply returns false when building
> > on a Windows platform.
> >
> > Does that mean that I cannot use 'cmake -E create_symlink' on Windows.
> > If that's the case I consider it a bug, because the documentation
> > suggests that 'cmake -E create_symlink' provides a platform independent
> > way of creating symbolic links. So, if the OS and/or filesystem does not
> > support symbolic links, IMHO, it should just copy the file.
> >
> > Best regards,
> > Marcel Loose.
> >
>
> Simply copying the file might be just as bad if people assume it really IS a symlink... IMHO, if the OS can't create a symlink, cmake -E create_symlink should fail loudly, not just silently ignore it. And somebody should implement this function for Windows >= Vista/2008 (i.e. WINVER >= 0x0600):
>
> http://msdn.microsoft.com/en-us/library/aa363866(VS.85).aspx
>
> Michael

Hi Michael,

I think it depends. Failing loudly may not always be desirable, just as
failing silently.

In my particular case, I was just creating a bunch of symlinks to
directories; no need to discern these symlinks from the actual
directories, but I need to be able to access the directory contents.

When it comes to symlinks to files, there may be situations where you
would really like it to be a link, e.g. when editing the file. Would
that be a CMake usage scenario??

I don't know what's the best way to deal with this issue. What do the
CMake developers think of this?

I can't speak for the rest of the CMake developers, but personally, I just simply avoid symlinks at all costs in projects that are meant to be cross-platform. If I'm working on a Mac-or-Linux-only project, symlinks can sometimes be useful... but they are simply not useful on Windows.

Just my opinion,
David


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Michael Wild
In reply to this post by Hendrik Sattler

On 11. Dec, 2009, at 15:35 , Hendrik Sattler wrote:

> Zitat von Michael Wild <[hidden email]>:
>> On 11. Dec, 2009, at 15:17 , Hendrik Sattler wrote:
>>> Zitat von Michael Wild <[hidden email]>:
>>>> On 11. Dec, 2009, at 14:27 , Marcel Loose wrote:
>>>>> I was browsing the CMake sources for a problem I was facing with the
>>>>> creation of symlinks (on Unix that is) and I noticed that the
>>>>> SystemTools::CreateSymlink function simply returns false when building
>>>>> on a Windows platform.
>>>>>
>>>>> Does that mean that I cannot use 'cmake -E create_symlink' on Windows.
>>>>> If that's the case I consider it a bug, because the documentation
>>>>> suggests that 'cmake -E create_symlink' provides a platform independent
>>>>> way of creating symbolic links. So, if the OS and/or filesystem does not
>>>>> support symbolic links, IMHO, it should just copy the file.
>>>>
>>>> Simply copying the file might be just as bad if people assume it   really IS a symlink... IMHO, if the OS can't create a symlink,  cmake  -E create_symlink should fail loudly, not just silently  ignore it.  And somebody should implement this function for  Windows >=  Vista/2008 (i.e. WINVER >= 0x0600):
>>>>
>>>> http://msdn.microsoft.com/en-us/library/aa363866(VS.85).aspx
>>>
>>> For this, also see
>>> http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html
>>> Please note the UAC dialog when creating symlink on Vista. Have  fun, I'd say :-(
>>>
>>> And what do you do on WindowsXP? What to do on FAT filesystems?
>>> Additionally, without that extension above, it is non-obvious for  Windows users that a specific file is a symbolic link.
>>
>> The UAC-thing only applies to directories where the user has no  write-acces (including the admin), right? So if you're half-way  sane, and build in a user-owned directory, you should be UAC-free...
>
> To cite from that page:
> Vista and UAC
>
> One of the major Vista changes was the so called User Account Control (UAC). Due to UAC some API calls need elevation to administrative level, and this elevation must be acknowledged via the below shown dialog box. Unfortunately, and I still can't believe this, the API call CreateSymbolicLink is a call, which needs elevation, and thus causes this annoying dialog box come up every time a symbolic link is created.
>

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...

>
> So, no, every time, even on own directories. I don't currently use Vista or Windows7, though. Also read the rest of that part of the page: cmake should not use functions directly that need elevation.
>

Agreed, but then creating symlinks will be just plain impossible on Windows...

For the general interest: somebody did it for 4msysgit.

http://repo.or.cz/w/git/mingw/4msysgit.git/commitdiff/043a43e7ec1ca4aa492406f438d89e1f35df127a

Michael

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

David Cole
On Fri, Dec 11, 2009 at 10:04 AM, Michael Wild <[hidden email]> 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?

The fact is that Microsoft introduced "shortcuts" in Windows 95 and Apple had "aliases" on Mac OS even before that... and they are both conceptually equivalent to "symlinks."

symlinks are a *convenience* feature... but they are not supported everywhere universally. So write the code that uses them if they are there, but has an alternate strategy if they're not available. But don't blame Microsoft...

Maybe you should ask yourself why you're even bothering to write software for Windows if it's so bad.


:-)
David


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Alan W. Irwin
On 2009-12-12 09:44-0500 David Cole wrote:

> On Fri, Dec 11, 2009 at 10:04 AM, Michael Wild <[hidden email]> 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?

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.

Back on topic....

I am one of the lead developers of the PLplot CMake-based build system.
However, my development experience is Linux only so I must rely on my
Windows developer colleagues to catch any Linux-only or Unix-only mistakes I
put into our build system.  Up to this thread, I had no idea that there
wasn't some reliable way to create symlinks on Windows, and it's only by
chance that I haven't used create_symlink in any part of our build other
than the Linux-only documentation build.

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?

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.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Bill Hoffman
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 <[hidden email]> 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?
>
> 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.
>
> Back on topic....
>
> I am one of the lead developers of the PLplot CMake-based build system.
> However, my development experience is Linux only so I must rely on my
> Windows developer colleagues to catch any Linux-only or Unix-only
> mistakes I
> put into our build system.  Up to this thread, I had no idea that there
> wasn't some reliable way to create symlinks on Windows, and it's only by
> chance that I haven't used create_symlink in any part of our build other
> than the Linux-only documentation build.
>
> 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?
>
> 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.
>

Some things just can not be done cross platform.   For example reading/
writing the windows registry, creating an OSX application bundle, and
sym-links.  Also, some computers don't even have shared libraries.
Should we disable those features from CMake?  That said, the symlink
command is the only -E that does not work cross platform.   The -E
create_symlink does return failure from main when called on windows.
So, if you used it in a custom command which is the idea for -E stuff,
it would fail in a noticeable way (the build would fail).  If you call
it from execute_process, you should be checking the return value as well.

-Bill
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Michael Wild
In reply to this post by Alan W. Irwin

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 <[hidden email]> 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
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Alan W. Irwin
In reply to this post by Bill Hoffman
On 2009-12-12 12:02-0500 Bill Hoffman wrote:

> Some things just can not be done cross platform.   For example reading/
> writing the windows registry, creating an OSX application bundle, and
> sym-links.  Also, some computers don't even have shared libraries. Should we
> disable those features from CMake?  That said, the symlink command is the
> only -E that does not work cross platform.   The -E create_symlink does
> return failure from main when called on windows. So, if you used it in a
> custom command which is the idea for -E stuff, it would fail in a noticeable
> way (the build would fail).  If you call it from execute_process, you should
> be checking the return value as well.

I guess I am the victim of the assumption that all cmake -E commands are
supposed to work cross-platform since all of them do so (which I was glad to
hear) other than create_symlink.  Right now, here is what cmake -E help says
about that command.

   create_symlink old new    - create a symbolic link new -> old

If you simply added (UNIX ONLY) to that documentation string, then users
like me wouldn't make unwarranted assumptions.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Marcel Loose
On Sat, 2009-12-12 at 14:35 -0800, Alan W. Irwin wrote:

> On 2009-12-12 12:02-0500 Bill Hoffman wrote:
>
> > Some things just can not be done cross platform.   For example reading/
> > writing the windows registry, creating an OSX application bundle, and
> > sym-links.  Also, some computers don't even have shared libraries. Should we
> > disable those features from CMake?  That said, the symlink command is the
> > only -E that does not work cross platform.   The -E create_symlink does
> > return failure from main when called on windows. So, if you used it in a
> > custom command which is the idea for -E stuff, it would fail in a noticeable
> > way (the build would fail).  If you call it from execute_process, you should
> > be checking the return value as well.
>
> I guess I am the victim of the assumption that all cmake -E commands are
> supposed to work cross-platform since all of them do so (which I was glad to
> hear) other than create_symlink.  Right now, here is what cmake -E help says
> about that command.
>
>    create_symlink old new    - create a symbolic link new -> old
>
> If you simply added (UNIX ONLY) to that documentation string, then users
> like me wouldn't make unwarranted assumptions.
>
> Alan
> __________________________
> Alan W. Irwin
>
> Astronomical research affiliation with Department of Physics and Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
>
> Programming affiliations with the FreeEOS equation-of-state implementation
> for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
> package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
> Linux Links project (loll.sf.net); and the Linux Brochure Project
> (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________

I second that. I was also under the impression that 'cmake -E' provided
a nice abstraction for a number of commands that could be used
cross-platform, but with different syntaxes. Seems that create_symlink
is the odd one out here. Bummer!

The thing is: it's too late when the build fails (on Windows), because
long before then, I, as a developer of the build environment, decided to
use the presumed cross-platform command create_symlink, only to find out
much later that it doesn't work on Windows.

Best regards,
Marcel Loose.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Marcel Loose
In reply to this post by Marcel Loose
On Sat, 2009-12-12 at 12:02 -0500, Bill Hoffman wrote:

> 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 <[hidden email]> 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?
> >
> > 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.
> >
> > Back on topic....
> >
> > I am one of the lead developers of the PLplot CMake-based build system.
> > However, my development experience is Linux only so I must rely on my
> > Windows developer colleagues to catch any Linux-only or Unix-only
> > mistakes I
> > put into our build system.  Up to this thread, I had no idea that there
> > wasn't some reliable way to create symlinks on Windows, and it's only by
> > chance that I haven't used create_symlink in any part of our build other
> > than the Linux-only documentation build.
> >
> > 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?
> >
> > 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.
> >
>
> Some things just can not be done cross platform.   For example reading/
> writing the windows registry, creating an OSX application bundle, and
> sym-links.  Also, some computers don't even have shared libraries.
> Should we disable those features from CMake?  That said, the symlink
> command is the only -E that does not work cross platform.   The -E
> create_symlink does return failure from main when called on windows.
> So, if you used it in a custom command which is the idea for -E stuff,
> it would fail in a noticeable way (the build would fail).  If you call
> it from execute_process, you should be checking the return value as well.
>
> -Bill

Just out of curiosity: how does Cygwin handle this whole symbolic link
business?

Marcel Loose.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Bill Lorensen
http://en.wikipedia.org/wiki/Symbolic_link#Cygwin_symbolic_links

On Mon, Dec 14, 2009 at 3:28 AM, Marcel Loose <[hidden email]> wrote:

> On Sat, 2009-12-12 at 12:02 -0500, Bill Hoffman wrote:
>> 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 <[hidden email]> 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?
>> >
>> > 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.
>> >
>> > Back on topic....
>> >
>> > I am one of the lead developers of the PLplot CMake-based build system.
>> > However, my development experience is Linux only so I must rely on my
>> > Windows developer colleagues to catch any Linux-only or Unix-only
>> > mistakes I
>> > put into our build system.  Up to this thread, I had no idea that there
>> > wasn't some reliable way to create symlinks on Windows, and it's only by
>> > chance that I haven't used create_symlink in any part of our build other
>> > than the Linux-only documentation build.
>> >
>> > 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?
>> >
>> > 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.
>> >
>>
>> Some things just can not be done cross platform.   For example reading/
>> writing the windows registry, creating an OSX application bundle, and
>> sym-links.  Also, some computers don't even have shared libraries.
>> Should we disable those features from CMake?  That said, the symlink
>> command is the only -E that does not work cross platform.   The -E
>> create_symlink does return failure from main when called on windows.
>> So, if you used it in a custom command which is the idea for -E stuff,
>> it would fail in a noticeable way (the build would fail).  If you call
>> it from execute_process, you should be checking the return value as well.
>>
>> -Bill
>
> Just out of curiosity: how does Cygwin handle this whole symbolic link
> business?
>
> Marcel Loose.
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Marcel Loose
In reply to this post by Marcel Loose
On Mon, 2009-12-14 at 08:23 -0500, Bill Lorensen wrote:
> http://en.wikipedia.org/wiki/Symbolic_link#Cygwin_symbolic_links
>

OK, that puts us back at square one.

Why is it that CMake cannot use Windows shortcuts as an alternative to
Unix symbolic links, whereas Cygwin can?

Best regards,
Marcel Loose.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Michael Wild

On 14. Dec, 2009, at 14:29 , Marcel Loose wrote:

> On Mon, 2009-12-14 at 08:23 -0500, Bill Lorensen wrote:
>> http://en.wikipedia.org/wiki/Symbolic_link#Cygwin_symbolic_links
>>
>
> OK, that puts us back at square one.
>
> Why is it that CMake cannot use Windows shortcuts as an alternative to
> Unix symbolic links, whereas Cygwin can?
>
> Best regards,
> Marcel Loose.
>

Because somebody has to implement it ;-). And then I'm not sure that the tool-chain (i.e. compilers etc.) will be able to handle Windows-shortcuts. Does anybody know, or has visual studio available to try it out, whether e.g. CL.exe and RC.exe can handle Windows-shortcuts? What about MINGW, GnuWin32 and Intel compilers?

Michael
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Andreas Pakulat-2
In reply to this post by Marcel Loose
On 14.12.09 14:29:06, Marcel Loose wrote:
> On Mon, 2009-12-14 at 08:23 -0500, Bill Lorensen wrote:
> > http://en.wikipedia.org/wiki/Symbolic_link#Cygwin_symbolic_links
> >
>
> OK, that puts us back at square one.
>
> Why is it that CMake cannot use Windows shortcuts as an alternative to
> Unix symbolic links, whereas Cygwin can?

Becaue Cygwin emulates a complete filesystem IIRC (at least inside its
bash). The problem is not that cmake could not create a shortcut for the -E
create_symlink  call, the problem is that very few apps are able to
recognize the shortcut as symlink and act accordingly. So it simply doesn't
make any sense to create one if it only works when the user double-clicks
on it in explorer.

Andreas

--
Keep it short for pithy sake.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Richard Bateman

That is correct; Cygwin applications and compilers (anything that uses the cygwin filesystem) would be able to use it, but no windows applications (such as Visual Studio) would be able to do so.

NTFS has long supported hard-links (or Junction points: http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx), but that's not the same thing as a symlink, of course.  I have often used junctions on windows as a replacement for symlinks, but that can be a little confusing to a user that doesn't know how they work.  Symbolic links were (as has been mentioned) introduced in Windows Vista using the mklink command, and they also work in Windows 7.

Personally, I would find it useful to be able to have it create junction points on older versions of windows, but there are several problems; it might not be worth it.  The first problem is that it wouldn't work on FAT32; another big problem is that most windows users don't know how to remove a junction, and many tools don't know how to deal with them.  That being the case, if you delete a junction to a directory, a program not understanding that it is a junction could delete all the files in the directory that it points to.  There are some explorer extensions and other tools to help with that, but I would consider it dangerous to enable that by default.

Just my $.02 =]

--
Richard

14.12.2009, в 6:42, Andreas Pakulat написал(а):

> On 14.12.09 14:29:06, Marcel Loose wrote:
>> On Mon, 2009-12-14 at 08:23 -0500, Bill Lorensen wrote:
>>> http://en.wikipedia.org/wiki/Symbolic_link#Cygwin_symbolic_links
>>>
>>
>> OK, that puts us back at square one.
>>
>> Why is it that CMake cannot use Windows shortcuts as an alternative to
>> Unix symbolic links, whereas Cygwin can?
>
> Becaue Cygwin emulates a complete filesystem IIRC (at least inside its
> bash). The problem is not that cmake could not create a shortcut for the -E
> create_symlink  call, the problem is that very few apps are able to
> recognize the shortcut as symlink and act accordingly. So it simply doesn't
> make any sense to create one if it only works when the user double-clicks
> on it in explorer.
>
> Andreas
>
> --
> Keep it short for pithy sake.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake





_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows

Samuel E. Henley
In reply to this post by Marcel Loose
I think it comes down to what error to flag, “You can't use this command
on your operation system because we didn't implement it” or “your
operation system is obsolete – build a work-around” or “no message at
all because it's windows and no one does development with windows”. The
last is odd for a cross-platform make/auto tools replacement, but I
favor “your system is obsolete” – I least the script writer will know at
the first test of his code, to change his code – after all CMake is only
a tool. I use the junction program with my continuous and nightly builds
– otherwise I would have multiple copy of pre-build third-party
libraries or end up requiring the libraries to always be in the same
location(Linux). My Linux builds use the links for the same reason. The
only problem is when your using the explorer – you don't know it's a
link – so I always add batch files to remove or add the links using
junction – you could change their folder icon. There is a program to
link files but I've never found a use for linking single files. But your
right it doesn't work like Linux.

Samuel E. Henley OSRail.net






_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake