'xdg-mime query default' return multiple .desktop entries (fdo#60329,#1195718)

This commit is contained in:
Rex Dieter 2015-02-24 10:38:47 -06:00
parent c61879da8c
commit facfeb6473
3 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From e04f8065335e391f47b04513d395e02a7f13d56e Mon Sep 17 00:00:00 2001
From: Lionel Orry <lionel.orry@gmail.com>
Date: Wed, 13 Aug 2014 09:56:25 +0200
Subject: [PATCH 10/11] xdg-mime: do not report multiple desktop files
(BR60329)
since commit 050333e3, xdg-mime checks both defaults.list and
mimeinfo.cache. When a result is present in both files, it returns both
results separated by a space.
When this is the case, the desktop file name is made of the duplicated
filename and the following chain of executions does not work properly.
This commit tries to select the first found line before extracting the
desktop file name.
Signed-off-by: Lionel Orry <lionel.orry@gmail.com>
---
scripts/xdg-mime.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/xdg-mime.in b/scripts/xdg-mime.in
index 80781c8..74cadfa 100644
--- a/scripts/xdg-mime.in
+++ b/scripts/xdg-mime.in
@@ -383,7 +383,7 @@ defapp_generic()
for x in `echo "$xdg_system_dirs" | sed 's/:/ /g'`; do
for prefix in "$XDG_MENU_PREFIX" ""; do
DEBUG 2 "Checking $x/applications/${prefix}defaults.list and $x/applications/${prefix}mimeinfo.cache"
- trader_result=`grep "$MIME=" $x/applications/${prefix}defaults.list $x/applications/${prefix}mimeinfo.cache 2> /dev/null | cut -d '=' -f 2 | cut -d ';' -f 1`
+ trader_result=`grep "$MIME=" $x/applications/${prefix}defaults.list $x/applications/${prefix}mimeinfo.cache 2> /dev/null | head -n 1 | cut -d '=' -f 2 | cut -d ';' -f 1`
if [ -n "$trader_result" ] ; then
echo $trader_result
exit_success
--
2.1.0

View File

@ -0,0 +1,25 @@
From bed791793af46ccb69107b95af87862335d4a702 Mon Sep 17 00:00:00 2001
From: Rex Dieter <rdieter@gmail.com>
Date: Tue, 24 Feb 2015 10:29:04 -0600
Subject: [PATCH 11/11] add ChangeLog entry for previous commit
---
ChangeLog | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 0c0ab97..6f6097a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
=== xdg-utils 1.1.x ===
+2015-02-24 Lionel Orry <lionel.orry@gmail.com>
+ * xdg-mime: do not report multiple desktop files (BR60329)
+
2015-02-20 Rex Dieter <rdieter@fedoraproject.org>
* xdg-open: safer xdg-open (BR89130), inspired by patch from Vincent Bernat <bernat@debian.org>
--
2.1.0

View File

@ -4,7 +4,7 @@
Summary: Basic desktop integration functions
Name: xdg-utils
Version: 1.1.0
Release: 0.38.%{pre}%{?dist}
Release: 0.39.%{pre}%{?dist}
URL: http://portland.freedesktop.org/
%if 0%{?pre:1}
@ -25,6 +25,8 @@ Patch6: 0006-xdg-open-Improve-performance-of-get_key-function.patch
Patch7: 0007-Add-changelog-for-prior-commit.patch
Patch8: 0008-xdg-open-safer-xdg-open-BR89130.patch
Patch9: 0009-one-more-s-arg-target-rename-fix-for-prior-commit.patch
Patch10: 0010-xdg-mime-do-not-report-multiple-desktop-files-BR6032.patch
Patch11: 0011-add-ChangeLog-entry-for-previous-commit.patch
# make sure BuildArch comes *after* patches, to ensure %%autosetup works right
# http://bugzilla.redhat.com/1084309
@ -99,6 +101,9 @@ make install DESTDIR=%{buildroot}
%changelog
* Tue Feb 24 2015 Rex Dieter <rdieter@fedoraproject.org> 1.1.0-0.39.rc3
- 'xdg-mime query default' return multiple .desktop entries (fdo#60329,#1195718)
* Sat Feb 21 2015 Rex Dieter <rdieter@fedoraproject.org> 1.1.0-0.38.rc3
- minor s/$arg/$target/ fix for prior commit