Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 180057

Summary: kde-functions.eclass overwrites .desktop entries with broken/truncated versions
Product: Gentoo Linux Reporter: vltg0903
Component: EclassesAssignee: Gentoo KDE team <kde>
Status: RESOLVED FIXED    
Severity: major CC: caster, jakub
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: tested kde packages
kde-functions.eclass patch to filter uninstall.desktop files
broken_desktop_files

Description vltg0903 2007-05-27 21:53:22 UTC
The function postprocess_desktop_entries (called from kde.eclass kde_pkg_preinst) moves .desktop file entries from ${PREFIX}/share/applnk to ${PREFIX}/share/applications/kde.
In the case of kmenuedit-3.5.7 and several other packages - use
for F in /usr/kde/3.5/share/applications/kde/*.desktop; do echo -n "$F: "; (cat $F|wc -l); done 
and look for low line count to find out which ones - the Makefile produces an invalid .desktop file in the applnk directory which then overwrites the valid one in the applications/kde.The result in this special case is that you can't call the kmenueditor from the K symbol's context menu any more.

I don't know what the point of postprocess_desktop_entries is at all, otherwise I'd try to come up with some kind of fix. Perhaps just making sure no file is clobbered in the mv action would be enough...?

Reproducible: Always
Comment 1 Wulf Krueger (RETIRED) gentoo-dev 2007-05-28 00:52:53 UTC
As a quick band aid I've added the following check for an existing desktop file (which is hopefully good) in the destination directory before moving a potentially broken one from its legacy location there:

if [[ ! -f ${D}${PREFIX}/share/applications/kde/$(basename ${entry}) ]]; then
...
fi

This fixes kmenuedit and at least shouldn't make anything worse.

Carlo, please double-check this solution. Leaving this bug open for review.
Comment 2 vltg0903 2007-05-28 11:31:24 UTC
Created attachment 120508 [details]
tested kde packages
Comment 3 vltg0903 2007-05-28 11:47:33 UTC
I tested the fix: I copied /usr/kde/3.5/share/applications/kde to kde.bak, re-emerged all my kde packages (see 'tested kde packages' attachment), and diff'ed  the kde with kde.bak directory.

Outcome: before re-emerging, the following desktop files were broken (i.e. three lines long, with only 'Encoding' and 'Hidden' attributes set):
kappfinder.desktop from kappfinder-3.5.7
keditbookmarks.desktop from konqueror-3.5.7
kmenuedit.desktop from kmenuedit-3.5.7
kpager.desktop from kpager-3.5.7
kpersonalizer.desktop from kpersonalizer-3.5.7
ktip.desktop from ktip-3.5.7
Then there is panel_appearence.desktop from kcontrol-3.5.7, which is five lines long and might or might nor be broken.

After re-emerging, the desktop files associated with
kappfinder
kmenuedit
kpager
kpersonalizer
ktip
are fixed, all other desktop files in /usr/kde/3.5/share/applications/kde are unchanged.

That leaves four (possible) problems:
1) keditbookmarks.desktop, for which verbose counterpart exists
2) panel_appearence.desktop, same thing
3) Why are these three-liners created in the first place? Do they serve some purpose? Is this an upstream bug?
4) Are there any more cases of this problem in the rest of the kde packages?
Comment 4 vltg0903 2007-05-28 11:49:37 UTC
(In reply to comment #3)
> 1) keditbookmarks.desktop, for which verbose counterpart exists
Make that:
1) keditbookmarks.desktop, for which _no_ 'verbose' counterpart exists
Comment 5 vltg0903 2007-05-28 12:09:22 UTC
So I took a look at $WORKDIR/kmenuedit-3.5.7/kmenuedit/Makefile and found the source of the three-liner desktop files in this task:

install-data-local: uninstall.desktop
        $(mkinstalldirs) $(DESTDIR)$(kde_appsdir)/System
        $(INSTALL_DATA) $(srcdir)/uninstall.desktop $(DESTDIR)$(kde_appsdir)/Sys
tem/kmenuedit.desktop

KDE docs have to say this about it:
http://developer.kde.org/documentation/other/makefile_am_howto/en/_uninstalling_a_desktop_file_.html

So cleanest solution would perhaps be to check if the .desktop file is a three-liner before moving it, and throw a warning or error if a file is going to be clobbered when trying to move it.
Comment 6 vltg0903 2007-05-28 12:34:28 UTC
Created attachment 120515 [details]
kde-functions.eclass patch to filter uninstall.desktop files

Made a patch... still rather hackish, as the slightest change to the uninstall.desktop file upstream will break it.
Comment 7 Wulf Krueger (RETIRED) gentoo-dev 2007-05-28 19:12:41 UTC
Thanks for the patch, Andreas. Your help is greatly appreciated. 

After consulting with other kde herd members, we agree that this is not the best solution but we currently don't have a better one either. To prevent more problems for other users, I've applied your patch after extensive testing.
Comment 8 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2007-05-29 10:56:26 UTC
Sweet, got a script to find out what packages I have installed broken? Guess I timed the upgrade to 3.5.7 in a very bad time :)
Comment 9 Wulf Krueger (RETIRED) gentoo-dev 2007-05-29 17:29:09 UTC
Created attachment 120629 [details]
broken_desktop_files

Very quick and dirty script to find "uninstall" desktop files.
Comment 10 Wulf Krueger (RETIRED) gentoo-dev 2007-07-01 09:11:12 UTC
Ok, no follow-ups on this so this is fixed until they change the "uninstall" format.