rev 5763 - in kde-extras/kile/trunk/debian: . patches

Mark Purcell msp at alioth.debian.org
Thu Mar 22 22:44:07 CET 2007


Author: msp
Date: 2007-03-22 21:44:07 +0000 (Thu, 22 Mar 2007)
New Revision: 5763

Added:
   kde-extras/kile/trunk/debian/patches/fifo-in-tmp-2.diff
Modified:
   kde-extras/kile/trunk/debian/changelog
Log:
* Apply fifo-in-tmp patch from Thomas Braun
  - kile becomes CPU hog when "Let Kile process LyX..." is checked in
  config (Closes: #406470)

Modified: kde-extras/kile/trunk/debian/changelog
===================================================================
--- kde-extras/kile/trunk/debian/changelog	2007-03-22 10:35:02 UTC (rev 5762)
+++ kde-extras/kile/trunk/debian/changelog	2007-03-22 21:44:07 UTC (rev 5763)
@@ -1,12 +1,15 @@
 kile (1:1.9.3-2) UNRELEASED; urgency=low
- 
+
   * NOT RELEASED YET
 
   * Suggest: kpdf, gv (Closes: #408824)
     - kile: Kile should suggest/recommend kpdf and gv
   * Basic get-orig-source target
+  * Apply fifo-in-tmp patch from Thomas Braun
+    - kile becomes CPU hog when "Let Kile process LyX..." is checked in
+    config (Closes: #406470)
 
- -- Mark Purcell <msp at debian.org>  Sat,  3 Mar 2007 18:36:54 +0000
+ -- Mark Purcell <msp at debian.org>  Thu, 22 Mar 2007 21:44:38 +0000
 
 kile (1:1.9.3-1) unstable; urgency=low
 

Added: kde-extras/kile/trunk/debian/patches/fifo-in-tmp-2.diff
===================================================================
--- kde-extras/kile/trunk/debian/patches/fifo-in-tmp-2.diff	2007-03-22 10:35:02 UTC (rev 5762)
+++ kde-extras/kile/trunk/debian/patches/fifo-in-tmp-2.diff	2007-03-22 21:44:07 UTC (rev 5763)
@@ -0,0 +1,236 @@
+Index: kilelyxserver.h
+===================================================================
+--- kilelyxserver.h	(Revision 645204)
++++ kilelyxserver.h	(Arbeitskopie)
+@@ -24,11 +24,12 @@
+ #include <qptrlist.h>
+ #include <qintdict.h>
+ #include <qstringlist.h>
+-
++#include <ktempdir.h>
+ /**
+  * @short Simple server that impersonates as LyX to work with gBib, pyBibliographer etc.
+  * @author Jeroen Wijnhout <Jeroen.Wijnhout at kdemail.net>
+- * @version 0.1
++ * @author Thomas Braun
++ * @version 0.2
+  */
+ 
+ class QFile;
+@@ -61,11 +62,13 @@ signals:
+ 	void insert(const KileAction::TagData &);
+ 
+ private:
++	mode_t 				m_perms;
++	KTempDir			*m_tempDir;
+ 	QPtrList<QFile>					m_pipeIn;
+ 	QPtrList<QSocketNotifier>		m_notifier;
+ 	QIntDict<QFile>					m_file;
+ 	bool							m_running;
+-	QStringList 					m_pipes;
++	QStringList 			m_links,m_pipes;
+ };
+ 
+ #endif // _LYXSERVER_H_
+Index: kilelyxserver.cpp
+===================================================================
+--- kilelyxserver.cpp	(Revision 618283)
++++ kilelyxserver.cpp	(Arbeitskopie)
+@@ -1,6 +1,7 @@
+ /***************************************************************************
+     begin                : Sat Sept 9 2003
+-    copyright            : (C) 2003 by Jeroen Wijnhout
++    edit		 : Tue Mar 20 2007
++    copyright            : (C) 2003 by Jeroen Wijnhout, 2007 by Thomas Braun
+     email                : Jeroen.Wijnhout at kdemail.net
+  ***************************************************************************/
+ 
+@@ -17,6 +18,7 @@
+ #include <sys/types.h>
+ #include <stdlib.h> //getenv
+ #include <unistd.h> //read
++#include <fcntl.h>
+ 
+ #include "kilelyxserver.h"
+ #include "kileactions.h"
+@@ -30,31 +32,48 @@
+ #include <kdebug.h>
+ #include <klocale.h>
+ 
+-KileLyxServer::KileLyxServer(bool st) :
+-	m_running(false)
++KileLyxServer::KileLyxServer(bool startMe) :
++	m_perms( S_IRUSR | S_IWUSR ),m_running(false)
+ {
++	kdDebug() << "===KileLyxServer::KileLyxServer(bool" << startMe << ")===" << endl;
+ 	m_pipeIn.setAutoDelete(true);
+ 	m_notifier.setAutoDelete(true);
++
+ 	m_file.setAutoDelete(false);
++	m_tempDir = new KTempDir();
++	if(!m_tempDir)
++		return;
++
++	m_tempDir->setAutoDelete(true);
++
++	m_links << ".lyxpipe.in" << ".lyx/lyxpipe.in";
++	m_links << ".lyxpipe.out" << ".lyx/lyxpipe.out";
+ 
+-	QString home(QDir::homeDirPath());
+-	m_pipes << home+"/.lyxpipe.in" << home+"/.lyx/lyxpipe.in";
+-	m_pipes << home+"/.lyxpipe.out" << home+"/.lyx/lyxpipe.out";
++	for(uint i = 0; i< m_links.count() ; i++)
++	{
++		m_pipes.append( m_tempDir->name() + m_links[i] );
++		m_links[i].prepend(QDir::homeDirPath() + "/" );
++		kdDebug() << "m_pipes[" << i << "]=" << m_pipes[i] << endl;
++		kdDebug() << "m_links[" << i << "]=" << m_links[i] << endl;
++	}
+ 
+-	if (st) start();
++	if (startMe)
++		start();
+ }
+ 
+ KileLyxServer::~KileLyxServer()
+ {
+ 	stop();
+ 	removePipes();
++	delete m_tempDir;
+ }
+ 
+ bool KileLyxServer::start()
+ {
+-	if (m_running) stop();
++	if (m_running)
++		stop();
+ 
+-	kdDebug() << "starting the LyX server..." << endl;
++	kdDebug() << "Starting the LyX server..." << endl;
+ 
+ 	if (openPipes())
+ 	{
+@@ -70,7 +89,7 @@ bool KileLyxServer::start()
+ 				kdDebug() << "Created notifier for " << (*it)->name() << endl;
+ 			}
+ 			else
+-				kdDebug() << "No notifier created fro " << (*it)->name() << endl;
++				kdDebug() << "No notifier created for " << (*it)->name() << endl;
+ 			++it;
+ 		}
+ 		m_running=true;
+@@ -81,49 +100,78 @@ bool KileLyxServer::start()
+ 
+ bool KileLyxServer::openPipes()
+ {
++	kdDebug() << "===bool KileLyxServer::openPipes()===" << endl;
++	
+ 	bool opened = false;
+-	QFileInfo info;
++	QFileInfo pipeInfo,linkInfo;
+ 	QFile *file;
++	struct stat buf;
++	struct stat *stats = &buf;
+ 
+ 	for (uint i=0; i < m_pipes.count(); ++i)
+ 	{
+-		info.setFile(m_pipes[i]);
+-		if ( ! info.exists() )
++		pipeInfo.setFile(m_pipes[i]);
++		linkInfo.setFile(m_links[i]);
++ 		
++		QFile::remove(linkInfo.absFilePath());
++		linkInfo.refresh();
++ 		
++		if ( !pipeInfo.exists() )
+ 		{
+-			mode_t perms = S_IRUSR | S_IWUSR | S_IRGRP| S_IROTH;
+ 			//create the dir first
+-            if ( ! QFileInfo(info.dirPath(true)).exists() )
+-				if (mkdir(QFile::encodeName( info.dirPath() ), perms | S_IXUSR) == -1)
+-					perror( "Could not create directory for pipe ");
++			if ( !QFileInfo(pipeInfo.dirPath(true)).exists() )
++				if ( mkdir(QFile::encodeName( pipeInfo.dirPath() ), m_perms | S_IXUSR) == -1 )
++				{
++					kdError() << "Could not create directory for pipe" << endl;
++					continue;
++				}
+ 				else
+-					kdDebug() << "Created directory " << info.dirPath() << endl;
++					kdDebug() << "Created directory " << pipeInfo.dirPath() << endl;
+ 
+-			if (mkfifo(QFile::encodeName( m_pipes[i] ), perms) == -1)
+-   				perror( "Could not create pipe ");
++				if ( mkfifo(QFile::encodeName( pipeInfo.absFilePath() ), m_perms) != 0 )
++				{
++					kdError() << "Could not create pipe: " << pipeInfo.absFilePath() << endl;
++					continue;				
++				}
+ 			else
+-				kdDebug() << "Created pipe " << m_pipes[i] << endl;
++					kdDebug() << "Created pipe: " << pipeInfo.absFilePath() << endl;
+ 		}
+ 
+-		file  = new QFile(info.absFilePath());
+-		if (!file->open(IO_ReadWrite))
++		if ( symlink(QFile::encodeName(pipeInfo.absFilePath()),QFile::encodeName(linkInfo.absFilePath())) != 0 )
+ 		{
+-			kdError() << "Could not open " << info.absFilePath() << endl;
++			kdError() << "Could not create symlink: " << linkInfo.absFilePath() << " --> " << pipeInfo.absFilePath() << endl;
++			continue;
+ 		}
+-		else
++
++		file  = new QFile(pipeInfo.absFilePath());
++		pipeInfo.refresh();
++
++		if( pipeInfo.exists() && file->open(IO_ReadWrite) ) // in that order we don't create the file if it does not exist
++		{
++			kdDebug() << "Opened file: " << pipeInfo.absFilePath() << endl;
++			fstat(file->handle(),stats);
++			if( !S_ISFIFO(stats->st_mode) )
+ 		{
+-			kdDebug() << "Opened " << info.absFilePath() << endl;
++				kdError() << "The file " << pipeInfo.absFilePath() <<  "we just created is not a pipe!" << endl;
++				file->close();
++				continue;
++			}
++			else
++			{	// everything is correct :)
+ 			m_pipeIn.append(file);
+ 			m_file.insert(file->handle(),file);
+ 			opened=true;
+ 		}
+ 	}
+-
++		else
++			kdError() << "Could not open " << pipeInfo.absFilePath() << endl;
++	}
+ 	return opened;
+ }
+ 
+ void KileLyxServer::stop()
+ {
+-	kdDebug() << "stopping the LyX server..." << endl;
++	kdDebug() << "Stopping the LyX server..." << endl;
+ 
+ 	QPtrListIterator<QFile> it(m_pipeIn);
+ 	while (it.current())
+@@ -140,12 +188,17 @@ void KileLyxServer::stop()
+ 
+ void KileLyxServer::removePipes()
+ {
++  	for ( uint i = 0; i < m_links.count(); ++i)
++ 		QFile::remove(m_links[i]);
+  	for ( uint i = 0; i < m_pipes.count(); ++i)
+ 		QFile::remove(m_pipes[i]);
++
+ }
+ 
+ void KileLyxServer::processLine(const QString &line)
+ {
++	kdDebug() << "===void KileLyxServer::processLine(const QString " << line << ")===" << endl;
++	
+ 	QRegExp cite(":citation-insert:(.*)$");
+ 	QRegExp bibtexdbadd(":bibtex-database-add:(.*)$");
+ 




More information about the pkg-kde-commits mailing list