mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-04-21 21:52:03 +02:00
qt: openfile portal: do not use O_PATH fds
This allow to use xdg-open inside a snap Change-Id: I5ad7e067228b260174abf5c78d0a0e7c2cf8c31d
This commit is contained in:
parent
316750ad93
commit
886074dc1e
6 changed files with 110 additions and 3 deletions
|
@ -49,7 +49,7 @@ QT_MAJOR := 6
|
|||
QT_MINOR := 4
|
||||
QT_PATCH := 3
|
||||
QT_TARBALL_CHECKSUM := 29a7eebdbba0ea57978dea6083709c93593a60f0f3133a3de08b9571ee8eaab4
|
||||
DEBIAN_QT_VERSION := $(QT_MAJOR).$(QT_MINOR).$(QT_PATCH)-1
|
||||
DEBIAN_QT_VERSION := $(QT_MAJOR).$(QT_MINOR).$(QT_PATCH)-2
|
||||
DEBIAN_QT_DSC_FILENAME := libqt-jami_$(DEBIAN_QT_VERSION).dsc
|
||||
QT_JAMI_PREFIX := /usr/lib/libqt-jami
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
From f4410fcbb093f259eaff4a20fc4266a535479235 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastien Blin <sebastien.blin@savoirfairelinux.com>
|
||||
Date: Mon, 29 May 2023 13:09:53 -0400
|
||||
Subject: [PATCH] OpenFile portal: do not use O_PATH fds
|
||||
|
||||
Using O_PATH requires correctly specifying whether the fd is writable or
|
||||
not. Stating that the fd is writable without it actually being writable
|
||||
results into rejection on xdg-desktop-portal side. Other implementations
|
||||
like xdg-open or gtk have also moved away from O_PATH fds so this will
|
||||
make a matching implementation and avoid possible rejections from xdp.
|
||||
|
||||
Fixes: QTBUG-113143
|
||||
Original: https://codereview.qt-project.org/c/qt/qtbase/+/475425
|
||||
---
|
||||
qtbase/src/gui/platform/unix/qgenericunixservices.cpp | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/qtbase/src/gui/platform/unix/qgenericunixservices.cpp b/qtbase/src/gui/platform/unix/qgenericunixservices.cpp
|
||||
index a0e5466c58..fe0fdaa625 100644
|
||||
--- a/qtbase/src/gui/platform/unix/qgenericunixservices.cpp
|
||||
+++ b/qtbase/src/gui/platform/unix/qgenericunixservices.cpp
|
||||
@@ -163,8 +163,7 @@ static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url)
|
||||
// handle_token (s) - A string that will be used as the last element of the @handle.
|
||||
// writable (b) - Whether to allow the chosen application to write to the file.
|
||||
|
||||
-#ifdef O_PATH
|
||||
- const int fd = qt_safe_open(QFile::encodeName(url.toLocalFile()), O_PATH);
|
||||
+ const int fd = qt_safe_open(QFile::encodeName(url.toLocalFile()), O_RDONLY);
|
||||
if (fd != -1) {
|
||||
QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
|
||||
"/org/freedesktop/portal/desktop"_L1,
|
||||
@@ -174,16 +173,13 @@ static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url)
|
||||
QDBusUnixFileDescriptor descriptor;
|
||||
descriptor.giveFileDescriptor(fd);
|
||||
|
||||
- const QVariantMap options = {{"writable"_L1, true}};
|
||||
+ const QVariantMap options = {};
|
||||
|
||||
// FIXME parent_window_id
|
||||
message << QString() << QVariant::fromValue(descriptor) << options;
|
||||
|
||||
return QDBusConnection::sessionBus().call(message);
|
||||
}
|
||||
-#else
|
||||
- Q_UNUSED(url);
|
||||
-#endif
|
||||
|
||||
return QDBusMessage::createError(QDBusError::InternalError, qt_error_string());
|
||||
}
|
||||
--
|
||||
2.40.1
|
||||
|
|
@ -1 +1,2 @@
|
|||
0001-fix-gcc13.patch
|
||||
0001-fix-gcc13.patch
|
||||
0002-OpenFile-portal-do-not-use-O_PATH-fds.patch
|
|
@ -27,6 +27,7 @@ Vendor: Savoir-faire Linux Inc.
|
|||
URL: https://jami.net/
|
||||
Source: jami-libqt-%{version}.tar.xz
|
||||
Patch0: 0001-fix-gcc13.patch
|
||||
Patch1: 0002-OpenFile-portal-do-not-use-O_PATH-fds.patch
|
||||
|
||||
%global gst 0.10
|
||||
%if 0%{?fedora} || 0%{?rhel} > 7
|
||||
|
@ -62,6 +63,7 @@ This package contains Qt libraries for Jami.
|
|||
%prep
|
||||
%setup -n qt-everywhere-src-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
echo "Building Qt using %{job_count} parallel jobs"
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
From f4410fcbb093f259eaff4a20fc4266a535479235 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastien Blin <sebastien.blin@savoirfairelinux.com>
|
||||
Date: Mon, 29 May 2023 13:09:53 -0400
|
||||
Subject: [PATCH] OpenFile portal: do not use O_PATH fds
|
||||
|
||||
Using O_PATH requires correctly specifying whether the fd is writable or
|
||||
not. Stating that the fd is writable without it actually being writable
|
||||
results into rejection on xdg-desktop-portal side. Other implementations
|
||||
like xdg-open or gtk have also moved away from O_PATH fds so this will
|
||||
make a matching implementation and avoid possible rejections from xdp.
|
||||
|
||||
Fixes: QTBUG-113143
|
||||
Original: https://codereview.qt-project.org/c/qt/qtbase/+/475425
|
||||
---
|
||||
qtbase/src/gui/platform/unix/qgenericunixservices.cpp | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/qtbase/src/gui/platform/unix/qgenericunixservices.cpp b/qtbase/src/gui/platform/unix/qgenericunixservices.cpp
|
||||
index a0e5466c58..fe0fdaa625 100644
|
||||
--- a/qtbase/src/gui/platform/unix/qgenericunixservices.cpp
|
||||
+++ b/qtbase/src/gui/platform/unix/qgenericunixservices.cpp
|
||||
@@ -163,8 +163,7 @@ static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url)
|
||||
// handle_token (s) - A string that will be used as the last element of the @handle.
|
||||
// writable (b) - Whether to allow the chosen application to write to the file.
|
||||
|
||||
-#ifdef O_PATH
|
||||
- const int fd = qt_safe_open(QFile::encodeName(url.toLocalFile()), O_PATH);
|
||||
+ const int fd = qt_safe_open(QFile::encodeName(url.toLocalFile()), O_RDONLY);
|
||||
if (fd != -1) {
|
||||
QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
|
||||
"/org/freedesktop/portal/desktop"_L1,
|
||||
@@ -174,16 +173,13 @@ static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url)
|
||||
QDBusUnixFileDescriptor descriptor;
|
||||
descriptor.giveFileDescriptor(fd);
|
||||
|
||||
- const QVariantMap options = {{"writable"_L1, true}};
|
||||
+ const QVariantMap options = {};
|
||||
|
||||
// FIXME parent_window_id
|
||||
message << QString() << QVariant::fromValue(descriptor) << options;
|
||||
|
||||
return QDBusConnection::sessionBus().call(message);
|
||||
}
|
||||
-#else
|
||||
- Q_UNUSED(url);
|
||||
-#endif
|
||||
|
||||
return QDBusMessage::createError(QDBusError::InternalError, qt_error_string());
|
||||
}
|
||||
--
|
||||
2.40.1
|
||||
|
|
@ -46,7 +46,7 @@ CMAKE_PREFIX_PATH="${QT_JAMI_PREFIX}/lib/cmake:${CMAKE_PREFIX_PATH}"
|
|||
QT_MAJOR=6
|
||||
QT_MINOR=4
|
||||
QT_PATCH=3
|
||||
QT_RELEASE_PATCH=1
|
||||
QT_RELEASE_PATCH=2
|
||||
|
||||
QT_MAJOR_MINOR=${QT_MAJOR}.${QT_MINOR}
|
||||
QT_MAJOR_MINOR_PATCH=${QT_MAJOR}.${QT_MINOR}.${QT_PATCH}
|
||||
|
|
Loading…
Add table
Reference in a new issue