Bug 66095

Summary: tags generation with ctags does not works for large file count
Product: [Applications] kdevelop Reporter: Ralf Habacker <ralf.habacker>
Component: CTagsAssignee: KDevelop Developers <kdevelop-devel>
Status: RESOLVED FIXED    
Severity: normal CC: roberto
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Cygwin   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ralf Habacker 2003-10-16 08:36:30 UTC
Version:           3.0.0 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 2.59 
OS:          Cygwin

On windows (cygwin) the maximum command line length is 8192, which let ctags fails in case of large file count.
Comment 1 Ralf Habacker 2003-10-16 08:36:45 UTC
The following patch fixes this by using a temporay file list in the same location of the created tags file. 


cvs server: Diffing parts/ctags
Index: parts/ctags/ctagspart.cpp
===================================================================
RCS file: /home/kde/kdevelop/parts/ctags/ctagspart.cpp,v
retrieving revision 1.23
diff -u -b -r1.23 ctagspart.cpp
--- parts/ctags/ctagspart.cpp   20 Sep 2003 11:03:46 -0000      1.23
+++ parts/ctags/ctagspart.cpp   16 Oct 2003 06:32:58 -0000
@@ -295,24 +295,37 @@
 {
        kdDebug(9022) << "create tags file" << endl;

+       QString tagFilesListName = project()->projectDirectory() + "/tags.files";
+
        KProcess proc;
        proc.setWorkingDirectory( project()->projectDirectory() );

        proc << "ctags";
        proc << "-n";
        proc << "--c++-types=+px";
+       proc << "-L " << tagFilesListName;
+
+       QFile f(tagFilesListName);
+       if (!f.open(IO_WriteOnly)) {
+               return false;
+       }
+
+       QTextStream stream(&f);

        QStringList l = project()->allFiles();
        QStringList::ConstIterator it;
        for (it = l.begin(); it != l.end(); ++it)
        {
-               proc << *it;
+               stream << *it << endl;
        }

+       f.close();
     QApplication::setOverrideCursor(Qt::waitCursor);
     bool success = proc.start(KProcess::Block);
     QApplication::restoreOverrideCursor();

+       f.remove();
+
     return success;
 }


Comment 2 Sascha Cunz 2003-11-01 02:42:00 UTC
Roberto Raggi recently changed this behaviour in a similar way the patch does.
Comment 3 Jens Dagerbo 2003-11-01 11:15:57 UTC
Indeed he did. Closing as fixed.