View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015416CMakeCMakepublic2015-02-24 04:042015-11-02 09:13
ReporterGunnar Roth 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformWindowsOSWindows OS Version7
Product VersionCMake 3.1.2 
Target VersionCMake 3.3Fixed in VersionCMake 3.3 
Summary0015416: AutogenInfo.cmake broken when Modules/AutogenInfo.cmake.in is read-only
Descriptionwe are using TFS from Microsoft as version control system, TFS does set the readonly flag on all non checked out files. we have cmake checked in so everybody gets the right version of it when building our software ( we also maintain some modifications to cmake).
the problem is that cmake does not remove readonly flag from its *.in files when copying, so modification fails.

our current workaround is that we do a
EXECUTE_PROCESS( COMMAND cmd /C attrib /S -R "${CMAKE_ROOT}/Modules/*.in" ERROR_QUIET)

but i would like it better, if cmake would be aware of files having readonly attribut set and remove that when copying the file.

regards,
Gunnar
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0038049)
Brad King (manager)
2015-02-24 09:00

There are many parts of CMake that copy files. Please post instructions for the use case in question.
(0038061)
Gunnar Roth (reporter)
2015-02-25 05:27

well in our case we get an error when creating a qt 5 project using automoc feature and create vs 2012 solutions and vcxprojs.
the error message is CMake Error: Internal CMake error when trying to open file: E:/TIA/bld/WM5_HmiIL_Proto_RenderHost/HmiGui/VS/WIN32-VS11-32/src/GfxQtRH/CMakeFiles/GfxQtRH_automoc.dir//AutogenInfo.cmake for writing.

that is because AutogenInfo.cmake is read only. It is read only because the source file cmake\share\cmake-3.2\Modules\AutogenInfo.cmake.in is also read only for the reason i mentioned above.
But that would probably happen for any other *.in file in Modules dir.
(0038065)
Brad King (manager)
2015-02-25 09:51

This can trigger for anything using configure_file() in CMake code or through internal C++ APIs within CMake. The command always preserves the permission of the .in file in the output file. The trouble comes when replacing it on future updates.

I think the low-level code for this is here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/kwsys/SystemTools.cxx;hb=v3.1.3#l2260 [^]

We already try to remove read-only files. The RemoveFile method:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/kwsys/SystemTools.cxx;hb=v3.1.3#l2575 [^]

already tries to remove read-only permission before removing the file.

Someone will need to dig deeper to understand why it doesn't work.
(0038263)
Brad King (manager)
2015-03-20 10:18

Relevant mailing list thread:

 AutogenInfo.cmake With Read-Only Modules
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/12745 [^]
(0038264)
Brad King (manager)
2015-03-20 10:39

The mailing list thread in 0015416:0038263 revealed that this is specific to AutgenInfo because we configure it and then append to it. Fixed:

 QtAutogen: Ensure write access to AutogenInfo.cmake
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=610464c1 [^]
(0039739)
Robert Maynard (manager)
2015-11-02 09:13

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

 Issue History
Date Modified Username Field Change
2015-02-24 04:04 Gunnar Roth New Issue
2015-02-24 09:00 Brad King Note Added: 0038049
2015-02-25 05:27 Gunnar Roth Note Added: 0038061
2015-02-25 09:51 Brad King Note Added: 0038065
2015-03-20 10:18 Brad King Note Added: 0038263
2015-03-20 10:24 Brad King Summary cmake does not remove readonly flag from its *.in files when copying, so modification fails. => AutogenInfo.cmake broken when Modules/AutogenInfo.cmake.in is read-only
2015-03-20 10:39 Brad King Note Added: 0038264
2015-03-20 10:39 Brad King Status new => resolved
2015-03-20 10:39 Brad King Resolution open => fixed
2015-03-20 10:39 Brad King Fixed in Version => CMake 3.3
2015-03-20 10:39 Brad King Target Version => CMake 3.3
2015-11-02 09:13 Robert Maynard Note Added: 0039739
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team