View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010793CMakeCPackpublic2010-06-03 18:172010-06-07 08:36
ReporterAndras Lasso 2 
Assigned ToDavid Cole 
PrioritynormalSeverityminorReproducibilityrandom
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionFixed in Version 
Summary0010793: Problem removing toplevel directory on Windows 7
DescriptionOn Windows 7 CPack sometimes cannot remove the toplevel directory before packaging. Most of the time this happens when the directory contains an svn working copy.

Errors are reported also when trying to delete the directory using Total Commander. Delete is successfully completed when it is retried.

Process Explorer shows that the Windows Search Indexer tries to access the directory that cannot be deleted (see the attached screenshot). The indexer is configured so that the all the packaging/build directories are excluded, however it still seems to temporarily access the directory.

Although the issue is not specific to CMake (but due to an aggressive file locking by Windows Search Indexer and a bug in its directory exclude implementation), CMake could be made more robust to be able to work correctly even in this environment (retry failed delete operation N times after some delay, before giving up).
Additional InformationAn example error log of a failed package creation:

1>------ Build started: Project: PACKAGE, Configuration: Release Win32
1>------
1>
1>Performing Post-Build Event...
1>CPack: Create package using NSIS
1>CPack Error: Problem removing toplevel directory:
1>C:/Users/andras/devel/Slicer-3.6/Slicer3-build/_CPack_Packages/win32/N
1>SIS CPack Error: Error when generating package: Slicer3 Project :
1>error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."
1>Project : warning PRJ0018 : The following environment variables were not found:
1>$(ProgramFiles)
1>Build log was saved at "file://c:\Users\andras\devel\Slicer-3.6\Slicer3-build\PACKAGE.dir\Release\BuildLog.htm" [^]
1>PACKAGE - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 273 up-to-date, 0 skipped ==========
TagsNo tags attached.
Attached Filesgif file icon Win7FileLockProblem.gif [^] (34,286 bytes) 2010-06-03 18:17

 Relationships

  Notes
(0020926)
Brad King (manager)
2010-06-04 13:08

Instead of cleaning an existing directory (_CPack_Packages/win32/NSIS) we should create a new randomly-generated name every time (_CPack_Packages/win32/NSIS/957sld). CPack can try to delete old paths but can ignore the failure case because it will generate a fresh name anyway.
(0020927)
Brad King (manager)
2010-06-04 14:45

As a less-intrusive workaround I've added code to repeat the removal attempt:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fdb5f787 [^]

Hopefully this makes total failure less likely.
(0020929)
Andras Lasso 2 (reporter)
2010-06-05 11:11

I've tested the cmake-2.8.1.20100603-g3d1e8-win32 version (compiled & packaged Slicer, repeated 3 times) and it worked perfectly. The file delete now works robustly on my Windows 7 PC!
(0020930)
Brad King (manager)
2010-06-07 08:35

Great, thanks for testing!

 Issue History
Date Modified Username Field Change
2010-06-03 18:17 Andras Lasso 2 New Issue
2010-06-03 18:17 Andras Lasso 2 File Added: Win7FileLockProblem.gif
2010-06-04 13:06 Brad King Status new => assigned
2010-06-04 13:06 Brad King Assigned To => David Cole
2010-06-04 13:08 Brad King Note Added: 0020926
2010-06-04 14:45 Brad King Note Added: 0020927
2010-06-05 11:11 Andras Lasso 2 Note Added: 0020929
2010-06-07 08:35 Brad King Note Added: 0020930
2010-06-07 08:36 Brad King Status assigned => closed
2010-06-07 08:36 Brad King Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team