MantisBT - CMake
View Issue Details
0012142CMakeCPackpublic2011-04-30 13:522016-06-10 14:31
Alan Garny 
Kitware Robot 
highmajoralways
closedmoved 
WindowsWindows 7 SP1
CMake 2.8.4 
 
0012142: Read-only files lose their read-only attribute when packaged using either ZIP or NSIS
To package a read-only file using CMake/CPack works as expected on Linux (using TGZ) and Mac OS X (using either PackageMaker or ZIP), but not on Windows (either using ZIP or NSIS).
To reproduce the problem:
 - Unzip the attached Test.zip file;
 - Either:
    - Double click on the packageproj.bat file; or
    - Open a command prompt window, cd to the directory where you unzipped the file, and execute the packageproj.bat file from the command prompt;
 - Execute [Test]\build\Test-0.1.1-win32.exe and/or unzip the [Test]\build\Test-0.1.1-win32.zip file;
 - Go to the installation/unzipped folder and check the permissions for our deployed readOnlyFile.txt file.

Expected result: our deployed readOnlyFile.txt file should be readable only.
Actual result: our deployed readOnlyFile.txt file is read-writable.
If you were to test the above on either Linux or Mac OS X (using, for example, the packageproj shell script which is provided), you would see that our deployed readOnlyFile.txt file is readable only, as expected.

Otherwise, it might be worth pointing out that, on Windows and for NSIS and ZIP respectively, [Test]\build\_CPack_Packages\win32\NSIS\Test-0.1.1-win32\readOnlyFile.txt and [Test]\build\_CPack_Packages\win32\ZIP\Test-0.1.1-win32\readOnlyFile.txt are read-only. So, could it be that the problem is during the packaging itself? It certainly looks like it.

From a reply I got on the mailing list, it would seem that the same libarchive is used for ZIP on the different platforms (see http://www.cmake.org/pipermail/cmake/2011-April/044124.html [^]). Still, I get the feeling that the problem might still be there (as we know, permissions are handled in a very different way on Windows compared to Linux / Mac OS X, so...?).

Finally, regarding NSIS, having checked the contents of [Test]\build\_CPack_Packages\win32\NSIS\project.nsi, it seems to me that the NSIS project file misses a call to SetFileAttributes with READONLY as a parameter. This would ensure that once deployed, our readOnlyFile.txt is indeed read-only. At least, this is what I had to do for another project of mine for which I had to 'manually' write a NSIS project file.
No tags attached.
related to 0012865closed Kitware Robot CPack generated archives don't have correct permissions when cross compiling on windows 
zip Test.zip (1,558) 2011-04-30 13:52
https://public.kitware.com/Bug/file/3841/Test.zip
Issue History
2011-04-30 13:52Alan GarnyNew Issue
2011-04-30 13:52Alan GarnyFile Added: Test.zip
2012-08-11 11:09David ColeStatusnew => backlog
2012-08-11 11:09David ColeNote Added: 0030256
2013-03-08 07:44Eric NOULARDRelationship addedrelated to 0012865
2016-06-10 14:28Kitware RobotNote Added: 0041837
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0030256)
David Cole   
2012-08-11 11:09   
Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0041837)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.