Summary: | "Prune selection" deletes ALL project files without even asking the user if he wants to. | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Barade <barade.barade> |
Component: | Build tools: CMake | Assignee: | kdevelop-bugs-null |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | aleixpol, barade.barade |
Priority: | NOR | ||
Version: | 2.2 | ||
Target Milestone: | 4.2.0 | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Barade
2011-05-21 17:16:47 UTC
Found corresponding code lines: KJob* CMakeBuilder::prune( KDevelop::IProject* project ) { KUrl builddir = CMake::currentBuildDir( project ); if( builddir.isEmpty() ) { KMessageBox::information(KDevelop::ICore::self()->uiController()->activeMainWindow(), i18n("No Build Directory configured, cannot clear builddir"), i18n("No clearing of builddir possible") ); return 0; } QDir d( builddir.toLocalFile() ); KUrl::List urls; foreach( const QString& entry, d.entryList( QDir::NoDotAndDotDot | QDir::AllEntries ) ) { KUrl tmp = builddir; tmp.addPath( entry ); urls << tmp; } return KIO::del( urls ); } In my opinion that is really horrible code. You should at least ask user for confirmation and maybe add some checks if URLs are temporary files and do not belong to the project since in my case I had selected my project folder as build directory. I assume you did not use an out-of-source build directory? indeed, there this is very dangerous. Aleix? My only code here is the one checking there actually is a build directory configured... And yes, that's pretty dangerous (I still think we shouldn't let the user have a in-source builddir in KDevelop). I'll add a check to see if there is a CMakeLists.txt file then don't remove, but I'm not sure there can be some corner case where this can't be enough... Git commit b389cfb2e620abe089d4a86f2315503d6d95196f by Aleix Pol. Committed on 27/05/2011 at 19:13. Pushed by apol into branch '4.2'. Don't clean the build directory if it's a source dir. BUG: 273802 M +6 -0 projectbuilders/cmakebuilder/cmakebuilder.cpp http://commits.kde.org/kdevelop/b389cfb2e620abe089d4a86f2315503d6d95196f |