Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
1.2.0
-
None
-
Windows 7
-
be572cbd6d782837def91b78846f72baeb1e1f51
Description
I have:
Artifact-Example
Artifact { fileTags: ['hpp', 'rpc_header_file'] fileName: { return RpcFuncs.headerFilePath(input.fileName); } }
and RpcFuncs.headerFilePath() returns a absolute directory which is not a
subdirectory of the build directory.
Build directory: D:/tmp/qt-bugs/qbs-clean
headerFilePath: D:/tmp/lsv-generated
The problem could be the following loop in artifactcleaner.cpp
artifactcleaner.cpp
void ArtifactCleaner::cleanup(const TopLevelProjectPtr &project, const QList<ResolvedProductPtr> &products, const CleanOptions &options) ... // Directories created during the build are not artifacts (TODO: should they be?), // so we have to clean them up manually. QList<QString> dirList = directories.toList(); for (int i = 0; i < dirList.count(); ++i) { const QString &dir = dirList.at(i); if (dir.startsWith(project->buildDirectory) && FileInfo(dir).exists()) removeEmptyDirectories(dir, options); if (dir != project->buildDirectory) { const QString parentDir = QDir::cleanPath(dir + "/.."); /* -> */ if (parentDir != project->buildDirectory && !dirList.contains(parentDir)) dirList << parentDir; } } ....
If the directory of the artifact lies outside the build Directory,
the computed parent directory will never match the Path
project->buildDirectory and the dirList grows as fast as the index
i of the for loop grows. After the list consumes all available Memory
the process crashes.
The attachment contains an example source file, a qbs file, a build
Directory and the modules which are required to reproduce the Problem.