[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#383893: kxkb: multi-user problem with files in /tmp



Package: kdebase-bin
Version: 4:3.5.4-2
Severity: normal
Tags: patch

Hi, 

kxkb creates {layoutname}.xkm files in /tmp. Now think of a
multi-usersystem as with xdmcp. Since those *.xkm files won't be
deleted, only one user can create them. For all other users there's a
problem. 

I already have reported this upstream:
http://bugs.kde.org/show_bug.cgi?id=132421

This bug is also in Sarge forcing me to creaty my own kdebase debs for
our group. It would be nice if this could be fixed with etch, I'm
attaching a patch.

Thanks,
Bernd

-- no debconf information
diff -ru kdebase-3.5.4/kxkb/extension.cpp kdebase-3.5.4.new/kxkb/extension.cpp
--- kdebase-3.5.4/kxkb/extension.cpp	2006-03-17 11:17:41.000000000 +0100
+++ kdebase-3.5.4.new/kxkb/extension.cpp	2006-08-20 02:40:18.000000000 +0200
@@ -1,5 +1,6 @@
 #include <string.h>
 #include <errno.h>
+#include <stdlib.h>
 
 #include <qstring.h>
 #include <qmap.h>
@@ -22,6 +23,10 @@
 
 QMap<QString, FILE*> XKBExtension::fileCache;	//TODO: move to class?
 
+static QString user(void)
+{
+	return getenv("USER");
+}
 
 static QString getLayoutKey(const QString& layout, const QString& variant)
 {
@@ -30,7 +35,7 @@
 
 QString XKBExtension::getPrecompiledLayoutFilename(const QString& layoutKey)
 {
-	QString compiledLayoutFileName = m_tempDir + layoutKey + ".xkm";
+	QString compiledLayoutFileName = m_tempDir + username + "." + layoutKey + ".xkm";
 	return compiledLayoutFileName;
 }
 
@@ -42,6 +47,8 @@
 	
 	QStringList dirs = KGlobal::dirs()->findDirs ( "tmp", "" );
 	m_tempDir = dirs.count() == 0 ? "/tmp/" : dirs[0];
+
+	username = user();
 }
 
 bool XKBExtension::init()
diff -ru kdebase-3.5.4/kxkb/extension.h kdebase-3.5.4.new/kxkb/extension.h
--- kdebase-3.5.4/kxkb/extension.h	2006-03-17 11:17:41.000000000 +0100
+++ kdebase-3.5.4.new/kxkb/extension.h	2006-08-20 02:46:22.000000000 +0200
@@ -22,6 +22,7 @@
 private:
     Display *m_dpy;
 	QString m_tempDir;
+	QString username;
 	static QMap<QString, FILE*> fileCache;
 	
 	bool setLayoutInternal(const QString& model,

Reply to: