Bug 32924

Summary: [PATCH] [xdg-email] xdg-email outputs errors with localized KDE4
Product: Portland Reporter: Luc Menut <lmenut>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: 1.1.0 rc1   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: xdg-email doesn't call kfmclient_fix_exit_code() with KDE 4

Description Luc Menut 2011-01-08 14:46:37 UTC
xdg-email still outputs errors with KDE4 and some locale, because of issues in kfmclient_fix_exit_code().
with KDE4 in french:
xdg-email portland@lists.freedesktop.org
/usr/bin/xdg-email: line 391: test:  : nombre entier attendu comme expression
/usr/bin/xdg-email: line 392: test:  : nombre entier attendu comme expression
/usr/bin/xdg-email: line 393: test:  : nombre entier attendu comme expression

kde${KDE_SESSION_VERSION}-config --version 2>/dev/null
Qt : 4.6.2
Plate-forme de développement de KDE : 4.4.3 (KDE 4.4.3)
kde4-config : 1.0

the following commit to xdg-utils-common.in doesn't fix the issue in kfmclient_fix_exit_code() for KDE 4 with some locale.
http://cgit.freedesktop.org/portland/xdg-utils/commit/?id=2b0372adfb710d8b4cc6406cf4a24eb578d27bf5
2010-11-18 Rex Dieter <rdieter@fedoraproject.org>
* fixup kfmclient_fix_exit_code() for newer kde-config output * fix typo in xdg-mime manpage

As kfmclient_fix_exit_code() is usefull only for KDE <= 3.5.4 (see its comment), I think that xdg-email shouldn't call kfmclient_fix_exit_code with KDE 4 (like it is done in xdg-open).

The patch in attachment fixes this issue in this way.
Comment 1 Luc Menut 2011-01-08 14:49:16 UTC
Created attachment 41778 [details] [review]
xdg-email doesn't call kfmclient_fix_exit_code() with KDE 4
Comment 2 Fathi Boudra 2011-01-09 02:52:22 UTC
Fixed in http://cgit.freedesktop.org/portland/xdg-utils/commit/?id=2baf6ae56f9b622ca51aa79ff370676aaef93908

The committed fix is a bit different from your proposal.
Comment 3 Luc Menut 2011-01-09 04:31:01 UTC
(In reply to comment #2)
> Fixed in
> http://cgit.freedesktop.org/portland/xdg-utils/commit/?id=2baf6ae56f9b622ca51aa79ff370676aaef93908
> 
> The committed fix is a bit different from your proposal.

sorry, but I think your fix is wrong; kfmclient_fix_exit_code() is still called for kde 4, and immediately return 0 in this case, so it always masks the real exit code of kmailservice for kde 4, which is wrong.

reading more carefully the code, using kfmclient_fix_exit_code() in xdg-email is probably wrong even for kde 3 since that xdg-email uses kmailservice (in replacement of kfmclient) and kfmclient_fix_exit_code() is needed to workaround some bugs in old kfmclient.
# kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4
# It also always returns 1 in KDE 3.4 and earlier
# Simply return 0 in such case

kfmclient_fix_exit_code() was introduced by Waldo Bastian in xdg-open and xdg-email (at this time, xdg-email used kfmclient) by this commit:
kfmclient exec exit code is broken in KDE 3.5 series as well.
http://cgit.freedesktop.org/portland/xdg-utils/commit/?id=0420d6906b21694d93264adeba5d1744d044e4e9

later, when kmailservice has replaced kfmclient in xdg-email, the call to kfmclient_fix_exit_code in xdg-email should probably have been removed.
http://cgit.freedesktop.org/portland/xdg-utils/commit/?id=c4a7764bbe6d2356428dcba4baada9fb1de7b996

I think that "kfmclient_fix_exit_code $1" should be completely removed in xdg-email now.

for kfmclient_fix_exit_code(),
the line [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0;
is probably useless if kfmclient_fix_exit_code is called only for kde 3.
if you want to keep it, it should be replaced by 
[ x"$KDE_SESSION_VERSION" = x"4" ] && return $1;
in order to not mask the real exit code.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.