Path check in kdelibs/plasma/package.cpp ?

Frank Wilson frank-7Xpm4/OPOls2UKY7GvvS5PXRex20P6io at public.gmane.org
Sun Jan 4 18:18:11 GMT 2009


I've been trying out kde 4.2 beta 2 and I have an issue with the way
different wallpapers are loaded.

My problem is that I cannot change my wallpaper to one of the default
directory-packaged wallpapers that come with kde (n.b. single-image
wallpapers are fine!). When I click on the "Picture" drop down box none
of the directory-packaged wallpapers display. When I select
one of the directory-packaged wallpapers the background is set to a
plain colour background and not the wallpaper I asked for.

When I select a directory-packaged wallpaper or display the drop down
list I get messages such as the following:

> plasma(10713)/libplasma Plasma::Package::filePath:
>> "/System/Links/Shared/wallpapers/Vector_Sunset/contents/
>> screenshot.png" does not exist

and when I select a directory-packaged wallpaper I also get:

> QImage::scaled: Image is a null image

I am using GoboLinux, which does not use the FHS. So, on my distro
kde-libs is installed in /Programs/KDE-Libs/Current, kde-base-workspace
in /Programs/KDE-Base-Workspace/Current, etc. Everything is symlinked
under /System/Links/Executables, /System/Links/Shared, etc.

It seems that kde is looking for the wallpapers under 
/System/Links/Shared/wallpapers and it does not like symlinks such as,

/System/Links/Shared/wallpapers/Vector_Sunset

which points to

/Programs/KDE-Base-Workspace/4.1.85/Shared/wallpapers/Vector_Sunset

I know this because when I removed the symbolic link and replaced it 
with a physical copy of the wallpaper, everything worked once again.

I had a look at the code involved and it seems that you are doing
some sort of explicit checks for symbolic links in Package::filePath() 
in the file kdelibs/plasma/package.cpp .

Specifically, this check fails:

     if (canonicalized.startsWith(d->basePath)) { ...

I added a bit more debug output, namely:

     if (QFile::exists(path)) {
         // ensure that we don't return files outside of our base path
         // due to symlink or ../ games
         QDir dir(path);
         QString canonicalized = dir.canonicalPath() + QDir::separator();
		/*** Extra Debug output ***/
                 kDebug() << "canonical path is: " << canonicalized;
                 kDebug() << "base path is: " << d->basePath;
		/**************************/
         if (canonicalized.startsWith(d->basePath)) {
             return path;
         }
     }

Which gave me the following output when I tried to select a
directory-packaged wallpaper:

plasma(10713)/libplasma Plasma::Package::filePath: canonical path is: 
"/Programs/KDE-Base-Workspace/4.1.85/Shared/wallpapers/Vector_Sunset/contents/screenshot.png/"
plasma(10713)/libplasma Plasma::Package::filePath: base path is: 
"/System/Links/Shared/wallpapers/Vector_Sunset/"
plasma(10713)/libplasma Plasma::Package::filePath: 
"/System/Links/Shared/wallpapers/Vector_Sunset/contents/screenshot.png" 
does not exist

I have two questions about this. Firstly, is there some cmake option 
that would allow this check to pass? Secondly, what is the purpose of 
this check?

Thanks,

Frank Wilson









More information about the kde-core-devel mailing list