[cmake-developers] CPack/NSIS is broken after extended length paths fix

Clinton Stimpson clinton at elemtech.com
Mon Sep 21 08:56:27 EDT 2015


On Monday, September 21, 2015 12:28:37 PM Dmitry Kochkin wrote:
>  Hi Clint,
> 
> >>Actually it's even worse because in current master HEAD I can see that
> >>INST_DIR is empty in generated project: !define INST_DIR ""
> >>(not sure if that's caused by your change)
> >
> >Interesting... Do you know why this happens?  How is this problem related
> >to extended paths (with the \\?\ prefix)?  Do you have an example to
> >demonstrate this problem? That was my mistake, please ignore.>
> >>I've figured out that NSIS was not going to fix this (see 
> >>http://sourceforge.net/p/nsis/feature-requests/241/ )>
> >Maybe they'll accept a patch to fix it there?  Was there any effort to fix
> >it there?
> In the URL I've put they claim you should just use "\\?\" in your NSIS
> project. I guess it's also possible to fix NSIS, but we cannot rely that
> user have latest NSIS.

Using "\\?\" in a NSIS project is a workaround, not a fix.
If a workaround is put into CMake, then you are relying on the latest CMake, 
right?


> >>I've made a small patch to NSIS generator and template to put infamous
> >>\\?\ there.
> >>
> >>I can send directly to you as I guess you know more about these parts of
> >>code.>
> >You can send your patch to this mailing list for review.
> 
> Patch attached. It's a bit hacky, more fixing symptoms I guess. The purpose
> is only to demonstrate the idea. Let me know if it can be done in better
> way.

Yes, it fixes symptoms.  The correct and robust way to fix this is to fix NSIS.

I have concerns with this patch:

1. Are the paths cleaned before placed into the NSIS template?  Only clean 
paths can be prepended with \\?\.  For example, these paths may not contain 
"." or "../" in them.

2. This patch can break UNC paths.  UNC paths must be prepended with a "\\?
\UNC\" prefix instead of "\\?\".  If CPACK_TEMPORARY_DIRECTORY is a UNC path, 
this patch breaks it.

3. For the uninstall code put into the NSIS template, how do you know whether 
INSTDIR is a UNC path or not?  INSTDIR is determined by the end-user when 
installing the software.  Blindly prepending "\\?\" may not work all the time.

Clint


More information about the cmake-developers mailing list