[cmake-developers] [CMake 0012142]: Read-only files lose their read-only attribute when packaged using either ZIP or NSIS

Mantis Bug Tracker mantis at public.kitware.com
Sat Apr 30 13:52:58 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12142 
====================================================================== 
Reported By:                Alan
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12142
Category:                   CPack
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2011-04-30 18:52 WAT
Last Modified:              2011-04-30 18:52 WAT
====================================================================== 
Summary:                    Read-only files lose their read-only attribute when
packaged using either ZIP or NSIS
Description: 
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).

Steps to Reproduce: 
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.

Additional Information: 
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.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-04-30 18:52 Alan           New Issue                                    
2011-04-30 18:52 Alan           File Added: Test.zip                         
======================================================================




More information about the cmake-developers mailing list