View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013202CMakeCPackpublic2012-05-08 14:522013-04-17 08:54
ReporterDavid Golub 
Assigned ToDavid Cole 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformIntel x64OSMicrosoft WindowsOS VersionWindows 7
Product VersionCMake 2.8.8 
Target VersionCMake 2.8.11Fixed in VersionCMake 2.8.11 
Summary0013202: CPack fails with latest prerelease NSIS
DescriptionThere have been some changes to NSIS that break compatibility with CPack since the latest NSIS release. There is now a standard library function called RemoveSection, which conflicts with the function with the same name in CPack-generated NSIS scripts. Also, NSIS scripts must now explicitly specify that they require administrator access. Therefore, CPack-generated installers will give an error that they require elevation unless the user explicitly runs them as administrator. I'd like to submit a patch to resolve these issues:

diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in
--- a/Modules/NSIS.template.in
+++ b/Modules/NSIS.template.in
@@ -37,6 +37,9 @@
   ;Set compression
   SetCompressor @CPACK_NSIS_COMPRESSOR@
 
+ ;Require administrator access
+ RequestExecutionLevel admin
+
 @CPACK_NSIS_DEFINES@
 
   !include Sections.nsh
@@ -119,7 +122,7 @@
  "exit_${SecName}:"
 !macroend
  
-!macro RemoveSection SecName
+!macro RemoveSection_CPack SecName
   ; This macro is used to call section's Remove_... macro
   ;from the uninstaller.
   ;Input: section index constant name specified in Section command.
@@ -841,7 +844,7 @@
   DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
 
   ; Removes all optional components
- !insertmacro SectionList "RemoveSection"
+ !insertmacro SectionList "RemoveSection_CPack"
   
   !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
     
Steps To ReproduceDownload the latest NSIS source code from the NSIS Subversion repository. Build an installer for NSIS and install it. CPack will now fail to build NSIS packages.
Additional InformationPlease note that there is an unrelated bug in NSIS itself that will also cause CPack to fail. To fix this bug, edit Contrib\Language files\SimpChinese.nsh, changing the line

!insertmacro LANGFILE "SimpChinese" "Chinese (Simplified)"

to

!insertmacro LANGFILE "SimpChinese" "Chinese (Simplified)" "Chinese (Simplified)"

and similarly modifying the analogous line in TradChinese.nsh. This fix has already been reported to NSIS.
TagsNo tags attached.
Attached Filespatch file icon 0001-CPack-NSIS-Fix-compatibility-issues-with-prerelease-.patch [^] (1,335 bytes) 2012-05-09 15:38 [Show Content]

 Relationships
related to 0013203closedDavid Cole Add support for 64-bit NSIS 

  Notes
(0029422)
David Cole (manager)
2012-05-08 15:01

What latest NSIS release are you talking about?

The page at http://nsis.sourceforge.net/Main_Page [^] says the most recent release is version 2.46 from December, 2009. We have that one installed on several machines here at Kitware and have not encountered any problems with RemoveSection.

Also, I do not think it's appropriate to add "RequestExecutionLevel admin" to all CPack NSIS scripts. You should customize or insert that in one of the CPack variables if you want it. (Or it should be enabled optionally at the very least.)

The CMake NSIS-generated installer works fine without admin privileges on Windows machines that do not automatically run installers as admin. If you don't have admin privileges, you have to install to a location where you do have write permissions, but other than that, our installer works fine without admin privileges right now, and I do not want to require an install-as-admin for CMake unless it's absolutely required and necessary.

As of right now, it is not necessary.
(0029423)
David Golub (reporter)
2012-05-08 16:35

I'm referring to the latest code in the the NSIS Subversion repository at https://nsis.svn.sourceforge.net/svnroot/nsis, [^] which includes changes since 2.46 was released. If you build NSIS from source using the latest code, the resulting version will include a standard library function RemoveSection that was introduced after NSIS 2.46 was released.

NSIS-generated installers do run as administrator, including the installers for CMake available on your web site. This is indicated by the small shield icon overlay displayed next to the executable file and the "Do you want to allow the following program from an unknown publisher to make changes to your computer?" message box that appears when you run the installer on Windows 7.

Upon further investigation, it appears that the issue that I was experiencing is specific to the 64-bit version of NSIS. (See bug 13203.) Installers built with 32-bit NSIS are identified by Windows are requiring administrative access, despite not being marked as having such a requirement in their manifests. I suspect that, when Microsoft first introduced UAC, they may have added code to detect NSIS installers in order to maintain compatibility with existing programs. This does not work for 64-bit NSIS, though, as it did not exist until last week. In order to be able to built 64-bit NSIS installers with CPack, it is necessary to add "RequestExecutionLevel admin" to tell NSIS to mark the manifest as requiring administrative access. This will have no effect on 32-bit NSIS installers, which are already prompting for administrative access.
(0029424)
David Cole (manager)
2012-05-08 16:54
edited on: 2012-05-08 16:55

Right, so run-as-admin is enforced on Windows that has UAC, by the system.

Why then do we need the RequestExecutionLevel call? On Windows XP, our installers run just fine without admin privileges.

(Never mind... I just read the last bit that explains why you need RequestExecutionLevel.)

(0029425)
David Cole (manager)
2012-05-08 17:02

Please create patches for CMake using git, based on the 'master' branch, and then:

  git format-patch -1

And then attach the resulting .patch file to this issue in the bug tracker.

Thanks.
(0029426)
David Golub (reporter)
2012-05-08 17:02

The RequestExecutionLevel simply instructs the NSIS compiler to mark the manifest so that UAC will elevate the prompt to run the program with administrative access on Windows 7 and Windows Vista. It has no effect on Windows XP.
(0029459)
David Golub (reporter)
2012-05-09 15:38

I've uploaded the patch file as you've requested.
(0031073)
David Cole (manager)
2012-09-20 17:18

I will try to get this in soon, in time for 2.8.10-rc1
(0031142)
David Cole (manager)
2012-10-01 15:20

The deadline has past for getting proposed changes into CMake 2.8.10-rc1: setting target version to 2.8.11
(0031633)
David Cole (manager)
2012-11-20 16:56

Fix pushed and merged to the 'next' branch:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51da766a6d85397f9244f5ec426091848d9318ff [^]
(0032873)
Robert Maynard (manager)
2013-04-17 08:54

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-05-08 14:52 David Golub New Issue
2012-05-08 15:01 David Cole Note Added: 0029422
2012-05-08 16:35 David Golub Note Added: 0029423
2012-05-08 16:48 Eric NOULARD Relationship added parent of 0013203
2012-05-08 16:48 Eric NOULARD Relationship replaced related to 0013203
2012-05-08 16:54 David Cole Note Added: 0029424
2012-05-08 16:55 David Cole Note Edited: 0029424
2012-05-08 17:02 David Cole Note Added: 0029425
2012-05-08 17:02 David Golub Note Added: 0029426
2012-05-09 15:38 David Golub File Added: 0001-CPack-NSIS-Fix-compatibility-issues-with-prerelease-.patch
2012-05-09 15:38 David Golub Note Added: 0029459
2012-06-20 18:34 David Cole Assigned To => David Cole
2012-06-20 18:34 David Cole Status new => assigned
2012-08-14 19:12 David Cole Target Version => CMake 2.8.10
2012-09-20 17:18 David Cole Note Added: 0031073
2012-10-01 15:20 David Cole Note Added: 0031142
2012-10-01 15:20 David Cole Target Version CMake 2.8.10 => CMake 2.8.11
2012-11-20 16:56 David Cole Note Added: 0031633
2012-11-20 16:56 David Cole Status assigned => resolved
2012-11-20 16:56 David Cole Fixed in Version => CMake 2.8.11
2012-11-20 16:56 David Cole Resolution open => fixed
2013-04-17 08:54 Robert Maynard Note Added: 0032873
2013-04-17 08:54 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team