Verified Commit def11e34 authored by A. Wilcox's avatar A. Wilcox 🦊
Browse files

user/xdg-utils: fix many papercuts via fd.o MRs

parent 33fce3ea
......@@ -2,7 +2,7 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=xdg-utils
pkgver=1.1.3
pkgrel=0
pkgrel=1
pkgdesc="Basic desktop integration functions"
url="https://www.freedesktop.org/wiki/Software/xdg-utils/"
arch="noarch"
......@@ -13,10 +13,14 @@ makedepends="libxml2-utils libxslt lynx xmlto"
subpackages="$pkgname-doc"
source="https://portland.freedesktop.org/download/xdg-utils-$pkgver.tar.gz
xdg-screensaver-mv-T.patch
xdg-mime-gnome.patch
xdg-mime-plasma.patch
xdg-open-failure.patch
xdg-open-spaces.patch
xdg-su-lxqt.patch
"
build() {
cd "$builddir"
./configure \
--build=$CBUILD \
--host=$CHOST \
......@@ -28,9 +32,13 @@ build() {
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
}
sha512sums="d1f819a211eb4104a90dfdc6fedcb640fd46b15ccfc8762266f8f538c49d74cb00027b8c1af991fb2a200acb4379986ae375700e06a2aa08fb41a38f883acb3e xdg-utils-1.1.3.tar.gz
db0896979fbc3b575826b4d732658564d08bcfc957b3fa1490fe02e4cc7b52adfa1e05956432a732dae8f50145e0040bc145739ba5692ae1b86fa74be8174436 xdg-screensaver-mv-T.patch"
db0896979fbc3b575826b4d732658564d08bcfc957b3fa1490fe02e4cc7b52adfa1e05956432a732dae8f50145e0040bc145739ba5692ae1b86fa74be8174436 xdg-screensaver-mv-T.patch
f8a711f349a690a950339574209fdaa6e06ef05644d8c83fd90b0c6abe9f64a457320e02a53c3cf4a68630fe15872c2786189c34014635169c8ba40e5fe0f693 xdg-mime-gnome.patch
0270c722a4655815c7d2c042340c2bc16b1d99d1b1e4f4bf160c549afbd5620b88dfaaf31f2bbd1bafcf8d153f40e72af53006b94651a3a787c0dccec63dbb0c xdg-mime-plasma.patch
17d1941fb81cb8b0bf23817b4d57c603bdcb4abc2919d8c6ce0dff4ce27cc83b33454740c881a67f9d9cb329ba1ea941067fcaca1fc82900d94c540699bf29cd xdg-open-failure.patch
8f3888313dd74a6b6332aa8a41525d517e47bf37450fd361543df06146ed91e8d5a2be9762a10535a557b88f7c3d0c47904b0a250109f7d1a783d9ec30aaba04 xdg-open-spaces.patch
48f7f976cf54741fb8fce7f559a0bfd08567363759e7788b8607066a32b0666e8ba1d4c7d2f9599950df81f0b71bd8114b20e937ece5ad88ec7f378ac8e8a9ac xdg-su-lxqt.patch"
From 0547886c0a7ae79145998495a6e3af6a1450d0c7 Mon Sep 17 00:00:00 2001
From: Martin Puppe <dev@mpuppe.de>
Date: Sat, 13 Apr 2019 12:46:44 +0200
Subject: [PATCH] xdg-mime: return correct exit code for GNOME
If the desktop environment was GNOME and none of the commands for
detecting the MIME type of a file was available, xdg-mime used to return
exit code 0 even though it failed. The man page says it should return
exit code 3. This commit fixes the issue.
I have considered returning exit code 4 instead since that is what would
be returned if info_kde() or info_generic() fail to find a tool for MIME
type detection. But I have decided to implement the behavior as
specified in the man page.
The exit code of an if construct is 0 if no condition
tested true [^1]. The author of the original code probably was not aware
of this.
[^1]: https://www.gnu.org/software/bash/manual/html_node/Conditional-Constructs.html#Conditional-Constructs
---
scripts/xdg-mime.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/xdg-mime.in b/scripts/xdg-mime.in
index 0e567c7..034d0ef 100644
--- a/scripts/xdg-mime.in
+++ b/scripts/xdg-mime.in
@@ -84,6 +84,8 @@ info_gnome()
elif gnomevfs-info --help 2>/dev/null 1>&2; then
DEBUG 1 "Running gnomevfs-info \"$1\""
gnomevfs-info --slow-mime "$1" 2> /dev/null | grep "^MIME" | cut -d ":" -f 2 | sed s/"^ "//
+ else
+ exit_failure_operation_impossible "no method available for querying MIME type of '$filename'"
fi
if [ $? -eq 0 ]; then
--
2.21.0
From cf2a703b19d64f939890dcea79b3bd8d2a9a08fe Mon Sep 17 00:00:00 2001
From: Ongun Kanat <ongun.kanat@gmail.com>
Date: Fri, 12 Jul 2019 16:22:35 +0200
Subject: [PATCH] Fix xdg-mime for proper Plasma 5 support
This adds checks for Plasma 5 and runs kbuildsycoca5 after
updating mimeapps.list file. The path of the file is
detected via qtpaths utility.
---
scripts/xdg-mime.in | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/scripts/xdg-mime.in b/scripts/xdg-mime.in
index 0e567c7..1ac6a3d 100644
--- a/scripts/xdg-mime.in
+++ b/scripts/xdg-mime.in
@@ -133,7 +133,10 @@ make_default_kde()
# text/plain=gnome-gedit.desktop;gnu-emacs.desktop;
vendor="$1"
mimetype="$2"
- if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
+ if [ x"$KDE_SESSION_VERSION" = x"5" ]; then
+ default_dir=$(qtpaths --writable-path ConfigLocation)
+ default_file="$default_dir/mimeapps.list"
+ elif [ x"$KDE_SESSION_VERSION" = x"4" ]; then
default_dir=`kde4-config --path xdgdata-apps 2> /dev/null | cut -d ':' -f 1`
default_file="$default_dir/mimeapps.list"
else
@@ -148,7 +151,7 @@ make_default_kde()
DEBUG 1 "Updating $default_file"
mkdir -p "$default_dir"
[ -f "$default_file" ] || touch "$default_file"
- if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
+ if [ x"$KDE_SESSION_VERSION" = x"4" ] || [ x"$KDE_SESSION_VERSION" = x"5" ]; then
[ -f "$default_file" ] || touch "$default_file"
awk -v application="$vendor" -v mimetype="$mimetype" '
BEGIN {
@@ -207,7 +210,7 @@ make_default_kde()
}
}
' "$default_file" > "${default_file}.new" && mv "${default_file}.new" "$default_file"
- eval 'kbuildsycoca4'$xdg_redirect_output
+ eval 'kbuildsycoca${KDE_SESSION_VERSION}'$xdg_redirect_output
else
awk -v application="$vendor" -v mimetype="$mimetype" '
BEGIN {
@@ -576,6 +579,11 @@ if [ "$action" = "makedefault" ]; then
make_default_kde "$filename" "$mimetype"
make_default_generic "$filename" "$mimetype"
+ detectDE
+
+ if [ x"$DE" = x"kde" ]; then
+ eval 'kbuildsycoca${KDE_SESSION_VERSION}'$xdg_redirect_output
+ fi
done
exit_success
fi
--
2.21.0
From 0ad418b2543b532ec82298ac2660d3f222f10882 Mon Sep 17 00:00:00 2001
From: KARBOWSKI Piotr <piotr.karbowski@gmail.com>
Date: Sun, 23 Jun 2019 11:39:40 +0200
Subject: [PATCH] xdg-open: Exit also on non-zero exit status from 'Exec'
.desktop entry.
Currently if the tool that was taken out of .desktop file Exec field
will exit with non-zero exit code, xdg-open will then fallback to
open_generic() from search_desktop_file(), which will lead to opening
again the same file with the same tool and ending on opening the file
with web browser.
This may lead to situation when for example text editor that fails to
write file on exit, will open the unchanged file with web browsr.
Another real life example is if one were to exit from mpv with
control-C, xdg-open will again start mpv, then it will try to start
x-web-browser and ending with starting a browser from list -- firefox in
my case.
This must be a bug as it's not docummented anywhere. If we got to the
point where we exec $command_exec then xdg-open must exit even if
whatever was executed by $command_exec returned non-zero exit status.
---
scripts/xdg-open.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/xdg-open.in b/scripts/xdg-open.in
index 202f3e3..7cfdde0 100644
--- a/scripts/xdg-open.in
+++ b/scripts/xdg-open.in
@@ -325,6 +325,8 @@ search_desktop_file()
if [ $? -eq 0 ]; then
exit_success
+ else
+ exit_failure_operation_failed
fi
fi
--
2.21.0
From cc686869e9801b09abc29a3e72718ae0520aa97e Mon Sep 17 00:00:00 2001
From: Dominik Schmidt <dominik@schm1dt.ch>
Date: Sat, 8 Dec 2018 19:56:44 +0100
Subject: [PATCH] xdg-open: Fix unquoted variable expansion when looking for
.desktop files
The recursive find algorithm for the .desktop files has an unquoted path expansion
in the generic case, when no desktop environment specific tool is found.
Hence, if we have a directory layout containing something along the lines of
~/.local/share/applications/foo bar/
Then the recursion will expand into searching in:
* `~/.local/share/applications/foo`
* `~/bar/*`
instead of `~/.local/share/applications/foo bar/*`
---
scripts/xdg-open.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/xdg-open.in b/scripts/xdg-open.in
index 202f3e3..b3e0ba9 100644
--- a/scripts/xdg-open.in
+++ b/scripts/xdg-open.in
@@ -328,7 +328,7 @@ search_desktop_file()
fi
fi
- for d in $dir/*/; do
+ for d in "$dir"/*/; do
[ -d "$d" ] && search_desktop_file "$default" "$d" "$target"
done
}
--
2.21.0
Upstream-Bug: https://bugzilla.suse.com/show_bug.cgi?id=1120397
Upstream-Bug: https://github.com/lxqt/lxqt/issues/1653
From 132cbff34f00f67a83ea58919a982abe600f25c3 Mon Sep 17 00:00:00 2001
From: Fabio Pesari <posta@parallelo.eu>
Date: Sun, 7 Jul 2019 13:08:33 +0000
Subject: [PATCH] xdg-su: Fix escaping for lxqt-sudo
---
scripts/xdg-su.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/xdg-su.in b/scripts/xdg-su.in
index b7a9865..65463eb 100644
--- a/scripts/xdg-su.in
+++ b/scripts/xdg-su.in
@@ -84,7 +84,7 @@ su_lxqt()
if [ $? -eq 0 ] ; then
if [ -z "$user" ] ; then
# -s option runs as su rather then sudo
- $LXQTSU -s "$cmd"
+ $LXQTSU -s $cmd
else
# lxqt-sudo does not support specifying a user
su_generic
--
2.21.0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment