kde-config creates $HOME/.kde

Bug #268167 reported by Francois Gouget
4
Affects Status Importance Assigned to Milestone
kdelibs (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: kdelibs4c2a

kde-config creates the '$HOME/.kde/share/config' directory if it does not exist. This is a problem if one runs it via sudo (possibly indirectly) because then it creates a directory that the non-root user has no access to and cannot delete.

To reproduce this issue, do the following:

$ rm -rf ~/.kde
$ ls -ld ~/.kde
ls: /home/weaver/.kde: No such file or directory
$ sudo kde-config
[sudo] password for weaver:
$ ls -ld ~/.kde
drwx------ 3 root root 4096 2008-09-09 16:32 /home/weaver/.kde
$ rm -rf .kde
rm: cannot chdir from `.' to `.kde': Permission denied

Another easier way to reproduce the issue is to tweak $HOME:

$ mkdir /tmp/decoy
$ HOME=/tmp/decoy kde-config
$ ls -ld /tmp/decoy/.kde
drwx------ 3 weaver weaver 4096 2008-09-09 16:41 /tmp/decoy/.kde

This bug happens on both Ubuntu 7.10 and Ubuntu 8.04, but strangely not on my Debian Testing system.

Revision history for this message
Jonathan Thomas (echidnaman) wrote :

Any situation that would cause this would arise from launching KDE apps with sudo rather than kdesudo or gksu.

Revision history for this message
Francois Gouget (fgouget) wrote :

I think this is not a duplicate of bug 53845.

A regular KDE application needs to set up a complex runtime environment. For instance in bug 53845 we see that a simple text editor needs to start kdeinit, kded, knotify, kio_uiserver and maybe others. All these expect a fully set up environment and likely write state information in ~/.kde thus forcing its creation at some point.

However kde-config does not fork and exec any of these servers. Also a look at an strace shows no justification for creating ~/.kde. So it should be possible to fix kde-config to not create ~/.kde completely independently from whether 'sudo kate' can be made to behave sensibly or not.

Revision history for this message
Terence Simpson (tsimpson) wrote :

Maybe strace shows no justification, but try "kde-config --localprefix", "kde-config --path ..." and "kde-config --userpath" options. The functions used to read this information also seems to create them, so there's nothing kde-config can do (or that we can do to kde-config).

Revision history for this message
Francois Gouget (fgouget) wrote :

So maybe this bug should be reassigned to the package these functions are implemented in!
In the meantime, here's a proposed 'patch'... wrap kde-config with the following script:

---
#!/bin/sh
decoy=""
if [ -z "$HOME" ]
then
    decoy="/tmp/decoy"
    touch "$decoy"
fi
kde-config "$@"
rc="$?"
[ -z "$decoy" ] || rm "$decoy"
exit $rc
---

This does not impact kde-config's results in any way and stops it from messing up the poor user's account.

Revision history for this message
Francois Gouget (fgouget) wrote :

This does not look like a duplicate of bug #930912 "gui apps don't start, XAUTHORITY environment variable not kept" to me.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.