Author Topic: Fix for Bug #18744?  (Read 17500 times)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Fix for Bug #18744?
« on: October 11, 2012, 05:55:19 pm »
Windows users/devs: Attached is a patch to probably fix bug #18744:
http://developer.berlios.de/bugs/?func=detailbug&bug_id=18744&group_id=5358

...please give it a try and report back. Within the bug description there is also a way how to reproduce this.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Fix for Bug #18744?
« Reply #1 on: October 11, 2012, 09:10:24 pm »
Quote
This bug was introduced between nightly 7966 and 8024.
Which is the exact revision, where the bug have been introduced?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Fix for Bug #18744?
« Reply #2 on: October 12, 2012, 05:23:46 am »
Quote
This bug was introduced between nightly 7966 and 8024.
Which is the exact revision, where the bug have been introduced?
I would guess this:
* r7986: jenslody: fix calculation of relativeToCommonTopLevelPath in cbproject.cpp; fixes issue described here: http://forums.codeblocks.org/index.php/topic,16322.msg110516.html#msg110516
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Fix for Bug #18744?
« Reply #3 on: October 12, 2012, 06:49:26 am »
As far as I know we never really handled files on different volumes, even if it (accidently ?) might have worked before.

If I see it correctly, th erelevant part of the patch is this one (just cosmetical changes on the other places) :
Code
@@ -360,13 +362,17 @@ void cbProject::CalculateCommonTopLevelPath()
         ProjectFile* f = (*it);
 
         if (!f)
             continue;
 
         wxString fileName = f->file.GetFullPath();
-        f->relativeToCommonTopLevelPath = fileName.Right(fileName.Length() - m_CommonTopLevelPath.Length());
+        if ( f->file.GetVolume().IsSameAs(base.GetVolume()) )
+          f->relativeToCommonTopLevelPath = fileName.Right(fileName.Length() - m_CommonTopLevelPath.Length());
+        else
+          f->relativeToCommonTopLevelPath = fileName;
+
         f->SetObjName(f->relativeToCommonTopLevelPath);
     }
 }
 
 wxString cbProject::GetCommonTopLevelPath() const
 {

Wouldn't it be better to handle the different volume issue when calculating m_CommonTopLevelPath and not (only) when setting the relativeToCommonTopLevelPath for the files belonging to the project.
If the files are on different volumes m_CommonTopLevelPath is just empty and all files have to use absolut paths as relativeToCommonTopLevelPath.


By the way, I explicitely wrote, that I did not test it with files on different volumes:

Can you (and other devs) please test the attached patch ?

I did not test what happens, if files in a project are on different drives in windows.
« Last Edit: October 12, 2012, 06:51:48 am by jens »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Fix for Bug #18744?
« Reply #4 on: October 12, 2012, 07:01:15 am »
Wouldn't it be better to handle the different volume issue when calculating m_CommonTopLevelPath and not (only) when setting the relativeToCommonTopLevelPath for the files belonging to the project.
If the files are on different volumes m_CommonTopLevelPath is just empty and all files have to use absolut paths as relativeToCommonTopLevelPath.
My thoughts were that if you really have source file on another drive that its most likely that these are 3rd party libs or alike (i.e. mounted on a network share), so you would also have at least some file on the drive where the project is, too. Really: Who on earth would have its sources completely on a different drive? ??? However - it would still work with my attempt.

Furthermore, if you look at the sources, in the above loop we have no wxFileName objects, but the path's are stings. I didn't want to implement a hacky volume extraction method and also taken into account that such calls are really costly I wanted to minimise the attempts for these very rare use-cases. Already now it slows down the calculation a lot and we all know what that means... count how often and when and where this method is called and you know what I mean. ::)

I did not test what happens, if files in a project are on different drives in windows.
No worries - nobody is complaining. As I wrote in the bug report already: This is actually a bad project setup and if not special care is taken it will lead to further problems when it comes to debugging, for example.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Fix for Bug #18744?
« Reply #5 on: October 12, 2012, 02:16:15 pm »
Wouldn't it be the best to just skip files, that are on volumes, that differ from the volume the projectfile is on, when the common toplevel is calculated ?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Fix for Bug #18744?
« Reply #6 on: October 12, 2012, 02:19:56 pm »
Wouldn't it be the best to just skip files, that are on volumes, that differ from the volume the projectfile is on, when the common toplevel is calculated ?
How?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Fix for Bug #18744?
« Reply #7 on: October 15, 2012, 08:51:30 am »
How?
Any ideas that came "over night"...?! ;-)

I think we should do something about it - otherwise Workspaces are pretty much broken for this special cases.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Fix for Bug #18744?
« Reply #8 on: October 15, 2012, 09:47:05 am »
How?
Any ideas that came "over night"...?! ;-)

I think we should do something about it - otherwise Workspaces are pretty much broken for this special cases.

I'm not at home at the moment (short brak at the northsea with my family until wednesday) so I have not really time to look into it, sorry.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Fix for Bug #18744?
« Reply #9 on: October 15, 2012, 10:10:27 am »
I'm not at home at the moment (short brak at the northsea with my family until wednesday) so I have not really time to look into it, sorry.
OK - no hurry then. BTW: It seems you are nearby to me atm... maybe we should held a dev-con at you way back... ;-) ;D
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Fix for Bug #18744?
« Reply #10 on: October 17, 2012, 11:58:44 pm »
I'm not at home at the moment (short brak at the northsea with my family until wednesday) so I have not really time to look into it, sorry.
OK - no hurry then. BTW: It seems you are nearby to me atm... maybe we should held a dev-con at you way back... ;-) ;D

Back at home.
I just reused your patch and added a skip files on different volume part (not yet tested on windows).
See: http://forums.codeblocks.org/index.php/topic,16967.msg115624.html#msg115624

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Fix for Bug #18744?
« Reply #11 on: October 18, 2012, 06:09:46 am »
Hey, Morten, thanks a lot! Your inspiration helped solve my 22-second project loading time!  ;D

Hats off to you.  8)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: Fix for Bug #18744?
« Reply #12 on: October 18, 2012, 07:00:16 am »
Hey, Morten, thanks a lot! Your inspiration helped solve my 22-second project loading time!  ;D
What did I do to help?! ??? :o
Did you solve it? (Oh - maybe I should read the bug report fist...)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Fix for Bug #18744?
« Reply #13 on: October 18, 2012, 10:27:51 am »
Hey, Morten, thanks a lot! Your inspiration helped solve my 22-second project loading time!  ;D
What did I do to help?! ??? :o
Did you solve it? (Oh - maybe I should read the bug report fist...)
I used your patch to handle files on different volumes and added aprt to skip files that are not on the same volume as the projects base-path when calculating the common toplevel path. But esecially this part needs more testing.