Fwd: Bug#292078: kdebase: startkde does not check lnusertemp's result?

Sune Vuorela debian at pusling.com
Mon Jan 15 22:57:47 GMT 2007


Hi!

A debian user reported this a long time ago to the debian bts, but the issue 
still applies. (original link: http://bugs.debian.org/293078 - but relevant 
info pasted below )

It has a patch for a issue about not handling possible errors in the calls to 
lnusertmp in the startkde-script.
He writes:

----start----

Version: 4:3.3.2-1
Priority: normal
Tags: security

The default startkde script provided with KDE does not seem to check any 
exit values for lnusertemp:

    165 # Link "tmp" resource to directory in /tmp
    166 # Creates a directory /tmp/kde-$USER and links $KDEHOME/tmp-$HOSTNAME 
to    166  it.
    167 lnusertemp tmp >/dev/null
    168
    169 # Link "socket" resource to directory in /tmp
    170 # Creates a directory /tmp/ksocket-$USER and links 
$KDEHOME/socket-$HOST    170 NAME to it.
    171 lnusertemp socket >/dev/null
    172
    173 # Link "cache" resource to directory in /var/tmp
    174 # Creates a directory /var/tmp/kdecache-$USER and links 
$KDEHOME/cache-$    174 HOSTNAME to it.
    175 lnusertemp cache >/dev/null

There are several reasons this is not correct, the most important being 
that if /tmp (or /var/tmp) are full and lnusertemp cannot do it's job 
(create a directory there), the startkde will happily keep on working even 
though the needed symlinks are not going to be there. 

IMHO the exit status of all of these actions should be tested, how about 
the attached patch to improve over the existing script? (it also includes a 
useful comment on how to prevent user files from ending up in /tmp or 
/var/tmp since KDE does not honor $TMPDIR)
---end---

I think the patch looks sane - and people in #kde-devel also commented that it 
was apparantly okay. (but no one commented really if it was needed)



/Sune
-- 
How can I send to the gadget?

From the panel inside Netscape 95 you must click a RAM 3D GPU for mounting the 
microprocessor.
-------------- next part --------------
--- startkde.orig	2005-01-25 00:48:59.000000000 +0100
+++ startkde	2005-01-25 00:51:18.000000000 +0100
@@ -162,20 +162,23 @@
     export GS_LIB
 fi
 
-# Link "tmp" resource to directory in /tmp
-# Creates a directory /tmp/kde-$USER and links $KDEHOME/tmp-$HOSTNAME to it.
-lnusertemp tmp >/dev/null
-
-# Link "socket" resource to directory in /tmp
-# Creates a directory /tmp/ksocket-$USER and links $KDEHOME/socket-$HOSTNAME to it.
-lnusertemp socket >/dev/null
-
-# Link "cache" resource to directory in /var/tmp
-# Creates a directory /var/tmp/kdecache-$USER and links $KDEHOME/cache-$HOSTNAME to it.
-lnusertemp cache >/dev/null
-
-# In case of dcop sockets left by a previous session, cleanup
-dcopserver_shutdown
+# Link "tmp" "socket" and "cache" resources to directory in /tmp
+# Creates:
+# - a directory /tmp/kde-$USER and links $KDEHOME/tmp-$HOSTNAME to it.
+# - a directory /tmp/ksocket-$USER and links $KDEHOME/socket-$HOSTNAME to it.
+# - a directory /var/tmp/kdecache-$USER and links $KDEHOME/cache-$HOSTNAME to it.
+# Note: temporary locations can be overriden through the KDETMP and KDEVARTMP
+# environment variables
+if [ ! -x "`which lnusertemp`" ] ; then
+	echo "Cannot find or run lnusertemp, aborting" >&2
+	exit 1
+fi
+for resource in tmp cache socket; do
+	if ! lnusertemp $resource >/dev/null; then
+		echo "Call to lnusertemp didn't succeed (temporary directories full?), aborting" >&2
+		exit 1
+	fi
+done
 
 echo 'startkde: Starting up...'  1>&2
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070115/0f4b37c8/attachment.sig>


More information about the kde-core-devel mailing list