Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: gmb300 on September 06, 2007, 09:34:29 am

Title: Project File Corruption (reproducable)
Post by: gmb300 on September 06, 2007, 09:34:29 am
Version: SVN 4420 (September 1, 2007)
OS: Linux

I am reporting 3 bugs in CodeBlocks, all are reproducable.

BUG #1
 * When saving a workspace, the '.workspace' extension must be explicitly added.
BUG #2
 * CodeBlocks only recognizes a workspace if it has the extension '.workspace'.
BUG #3 [SERIOUS]
 * CodeBlocks erases project files without warning!

Steps to reproduce:

Deleted... See my next few posts.
Title: Re: Project File Corruption (reproducable)
Post by: thomas on September 06, 2007, 10:16:33 am
1) fixed in rev 4428
2) not a bug
3) still looking
Title: Re: Project File Corruption (reproducable)
Post by: Der Meister on September 06, 2007, 02:33:24 pm
What about this thread (http://forums.codeblocks.org/index.php/topic,6119.0.html)? Will the extension be changed or does revision 4428 mean that it will remain ".workspace"?
Title: Re: Project File Corruption (reproducable)
Post by: thomas on September 06, 2007, 03:36:35 pm
I haven't changed anything to the extension as such (and won't for now).

Though I'm 100% for the change to .cbw, I don't want to tamper with extensions for now, as long as extension handling is  OBUH (one big ugly hack). Actually I wouldn't have done revision 4428 either, since it adds another piece of hardcode... but it's such an obvious dumb mistake which will annoy users every time they encounter it, so it should be "fixed" nevertheless.
Title: Re: Project File Corruption (reproducable)
Post by: gmb300 on September 06, 2007, 09:05:02 pm
I've narrowed the steps down.

Deleted... See my next post.
Title: Re: Project File Corruption (reproducable)
Post by: troels on September 06, 2007, 10:26:41 pm
I've narrowed the steps down.
This happens on Windows too (following the steps -> empty project)
/Troels
Title: Re: Project File Corruption (reproducable)
Post by: gmb300 on September 07, 2007, 03:24:34 am
New Set of Steps to Reproduce

1). Open fresh codeblocks
2). File -> New -> Project
3). Create console application
4). Reasonable defaults are okay
5). Project -> Properties
6). Click Build Targets Tab
7). Set Type to 'Dynamic library'
8). Uncheck the box Auto-generate filename extension
9). Set Output Filename to 'bin/Debug/testcb.dll'
10). Click OK
11). File -> Save Project
12). Click 'Rebuild' on the toolbar
13). File -> Close Project
14). File -> Open ... The project file does not exist!
Title: Re: Project File Corruption (reproducable)
Post by: gmb300 on September 07, 2007, 07:13:03 am
The problem is with Clean() ing, CodeBlocks thinks the project file is a static library. So C::B adds the project file to the list of files to be deleted.

Pseudo-Code:

if (project_target_type == ttDynamicLib &&
    m_PrefixGenerationPolicy == tgfpPlatformDefault &&
    m_ExtensionGenerationPolicy == tgfpNone)
  then
    call DirectCommands::GetTargetCleanCommands()
      return List_of_Files_To_Be_Deleted(Object Files, Project File)
Title: Re: Project File Corruption (reproducable)
Post by: Biplab on September 07, 2007, 08:01:27 am
Bug confirmed. Thanks for the report. Hopefully we'll be able to fix this soon. :)
Title: Re: Project File Corruption (reproducable)
Post by: Biplab on September 07, 2007, 11:31:57 am
Fix committed in revision 4435. Thanks for pointing this nasty bug. :)