Bug 139161 - QMake project appears empty after changes to it
Summary: QMake project appears empty after changes to it
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: QMake (show other bugs)
Version: 3.3.94
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Andreas Pakulat
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-23 10:47 UTC by Christian Schneider
Modified: 2007-01-05 18:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Schneider 2006-12-23 10:47:27 UTC
Version:           3.3.94 (using KDE 3.5.5, compiled sources)
Compiler:          gcc version 3.4.4
OS:                Linux (x86_64) release 2.6.17.9

I'm QMake for a Qt4 project with several sub-projects. When I make changes to any of the (sub-)projects, (add or remove a source file, remove a sub-project), the project view of the QMake-manager for the project in question is cleared and not updated anymore.

After re-opening the project, everything looks as expected, with the previous changes to the project applied.

Here is the debug output of KDevelop when I remove a source file from a project:

kdevelop (grep view): context in grepview
kdevelop: file context with /home/chrschn/uni/diplom/ModellingPSCC/src/cell_complex/moc_abstractmodel.cpp
kdevelop (trollproject): File is dirty:/home/chrschn/uni/diplom/ModellingPSCC/src/cell_complex/cell_complex.pro using method 
kdevelop (trollproject): Reloading Project
kdevelop (trollproject): Couldn't parse project: /home/chrschn/uni/diplom/ModellingPSCC/src/cell_complex/cell_complex.pro
Comment 1 Andreas Pakulat 2006-12-23 12:59:01 UTC
Hi, 

that output looks like you edited one of the .pro files and then told kdevelop to reload it.

Unfortunately that .pro file is not parseable for kdevelop, which in most cases means it contains an error.

So there are 2 questions:

1. Why don't you use the qmake manager to add/remove files (its normally on the right side of the editor)

2. Would you be so kind and send me the project, only the .pro files in their proper directory structure? (so I could try to reproduce and see whats really happening) Use the email from this bugzilla entry.

Andreas
Comment 2 Christian Schneider 2006-12-23 14:00:55 UTC
No, I didn't edit the .pro file directely. The log I posted was the
result of right-clicking the file 'moc_abstractmodel.cpp' and selecting
'Exclude'. The resulting .pro file must contain a valid syntax,
otherwise I would get the same error when I close the KDevelop-project
and reopen it. But as stated before, after re-opening the project,
everything is alright, including the change I made (file excluded).

Could it be a timing problem, that the parser tries to re-read the file
before it is completely written?
Comment 3 Jens Dagerbo 2006-12-23 14:13:03 UTC
Did you have the .pro file open in KDevelop at the time?
Comment 4 Andreas Pakulat 2006-12-23 14:37:54 UTC
I can reproduce a part of the problem, i.e. opening the .pro file in the editor and changing sth. via the QM does give me the reload-subproject dialog. However choosing either reload or no-reload doesn't clear the QM.

Also it seems that the .pro file is broken (cell_complex.pro), one thing that does break the qmake parser are end-of-line markers from Windows or MacOS (i.e. \r\n or \r only instead of \n) and I'm not sure I can fix that so easily...

If you can please send me the .pro files via private mail (apaku at gmx dot de)
Comment 5 Andreas Pakulat 2006-12-23 15:41:15 UTC
On 23.12.06 15:11:00, Christian Schneider wrote:
> Am Samstag, den 23.12.2006, 13:37 +0000 schrieb Andreas Pakulat:
> > I can reproduce a part of the problem, i.e. opening the .pro file in
> > the editor and changing sth. via the QM does give me the
> > reload-subproject dialog. However choosing either reload or no-reload
> > doesn't clear the QM.
> 
> I didn't edit or even open the .pro file in KDevelop or any other editor
> at any time. However, I can't reproduce this error every time, but quite
> often.


Ok.

> Steps to reproduce (if it occurs):
>      1. Open KDevelop. The last project gets automatically loaded.
>      2. Do some coding, don't know exactely what I did before. No .pro
>         file edited or opened.
>      3. Select the project "cell_complex" under the "src" project.
>      4. Right click any header file and choose "exclude"
>
> Result: The project tree view gets cleared, the buttons to build,
> rebuild and execute the sub-project become disabled.


Hmm, sorry, doesn't happen for me here :( And I also have no idea how
that could happen, there is AFAIK no code path from "Exclude file" to
"delete any of the project listview items"...

It happens really on any file, i.e. they don't have anything "special"
in common?

> > Also it seems that the .pro file is broken (cell_complex.pro), one
> > thing that does break the qmake parser are end-of-line markers from
> > Windows or MacOS (i.e. \r\n or \r only instead of \n) and I'm not sure
> > I can fix that so easily...
> 
> I can't imagine where this should come from,


Me neither, but to my knowledge thats all the parser cannot parse
(except for broken .pro files).

> If you need it, I can also send you the whole project with all source
> files and my .kdevelop project file.


No, I don't think thats necessary, the content of the source files
doesn't matter and neither does their existence to the QM.

All that is left is: How did you run configure on kdevelop? We had 1
bugreport where the qmake parser behaved strangely when built with -O2
and I guess that was due to some compile patches being done that
distro...

Other than that, I fear you'd have to try to debug this yourself. Of
course I can lend you a hand as to where set the breakpoints and what to
look out for. If you want to try that, I suggest we set up for a
"meeting" in IRC.

Andreas
Comment 6 Christian Schneider 2006-12-23 15:55:26 UTC
My configure line:
--prefix=/opt/kdevelop-3.4-SVN615773 --with-qt-libraries=/opt/qt/lib64 --with-kde-libs=/opt/kde/lib64 --enable-debug=full --disable-dependency-tracking --disable-final --enable-libsuffix=64 --disable-ada --disable-fortran --disable-haskell --disable-java --disable-clearcase --disable-perforce --disable-ruby --disable-python --disable-sql

My default CXXFLAGS (used for everything):
-O3 -march=athlon64 -mtune=athlon64 -s -pipe -mmmx -msse -msse2 -m3dnow -mfpmath=sse

I have an LFS system and use the 'original' GCC with no special 'enhancement' patches at all.

When I find out how I can reproduce this bug reliably, I can try to look into it with your help.
Comment 7 Christian Schneider 2007-01-05 15:45:00 UTC
I think all this is related to a problem with custom variables in the QMake-parser (or the AST that writes the file back, not sure).

Steps to reproduce the problem:
1. Create a new Qt4-Project
2. Open the Qt-options in the QMake manager for 'src'.
3. Add a custom variable, e. g. 'QMAKE_CXX=/usr/local/bin/g++'.
4. Quit the QMake manager with OK.
5. Open the file 'src.pro', it looks as it should:
   QMAKE_CXX = /usr/local/bin/g++
6. Open the QMake manager for 'src' again.
7. Change anything, e. g. set the build type from 'Release' to 'Debug'.
8. Quit the QMake manager with OK.
9. Open the file 'src.pro' again. The variable looks like:
   QMAKE_CXX = " /usr/local/bin/g++
   "

The resulting file used to get the QMake manager stuck with previous revisions. Currently I'm using SVN-revision 619225 and the QM doesn't get stuck anymore. Actually it seems to correctly parse the variable with the newline, but qmake can't parse it.
Comment 8 Andreas Pakulat 2007-01-05 16:41:02 UTC
Thanks for the reproduction steps and spending the time to figure it out. I actually didn't test the custom variables for some time now.

I'll fix this asap.
Comment 9 Andreas Pakulat 2007-01-05 18:26:36 UTC
SVN commit 620319 by apaku:

Fix custom variable handling
BUG: 139161


 M  +3 -3      scope.cpp  


--- branches/kdevelop/3.4/buildtools/qmake/scope.cpp #620318:620319
@@ -981,7 +981,7 @@
         QMap<QString,QString> temp;
         temp[ "var" ] = it.data()->scopedID;
         temp[ "op" ] = it.data()->op;
-        temp[ "values" ] = it.data()->values.join("");
+        temp[ "values" ] = it.data()->values.join("").stripWhiteSpace();
         result[ it.key() ] = temp;
     }
     return result;
@@ -994,7 +994,7 @@
     if ( id > 0 && m_customVariables.contains( id ) )
     {
         m_customVariables[ id ] ->values.clear();
-        updateValues( m_customVariables[ id ] ->values, newvalues );
+        updateValues( m_customVariables[ id ] ->values, newvalues.stripWhiteSpace() );
         if( m_varCache.contains( m_customVariables[ id ]->scopedID ) )
             m_varCache.erase( m_customVariables[ id ]->scopedID );
         m_customVariables[ id ] ->op = newop;
@@ -1007,7 +1007,7 @@
     QMake::AssignmentAST* newast = new QMake::AssignmentAST();
     newast->scopedID = var;
     newast->op = op;
-    newast->values.append(values);
+    newast->values.append(values.stripWhiteSpace());
     if( scopeType() == ProjectScope )
         newast->setDepth( m_root->depth() );
     else