summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2018-06-14 20:49:18 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2018-06-16 09:03:45 +0200
commit2b1052bd019ea0da390deaa54133531f8f9e3d02 (patch)
tree267f716ead3c19f16d473af63dd753d1fc388789
parentprofiles/package.mask: ruby22 has been removed (diff)
downloadgentoo-2b1052bd019ea0da390deaa54133531f8f9e3d02.tar.gz
gentoo-2b1052bd019ea0da390deaa54133531f8f9e3d02.tar.bz2
gentoo-2b1052bd019ea0da390deaa54133531f8f9e3d02.zip
kde-apps/kio-extras: Fix sftp links with >=kde-frameworks/kio-5.47
Upstream commit bca40518682a038aa08823fbbfb2cc4b9ef63802 Package-Manager: Portage-2.3.40, Repoman-2.3.9
-rw-r--r--kde-apps/kio-extras/files/kio-extras-18.04.2-fix-sftp-links.patch227
-rw-r--r--kde-apps/kio-extras/kio-extras-18.04.2-r1.ebuild80
2 files changed, 307 insertions, 0 deletions
diff --git a/kde-apps/kio-extras/files/kio-extras-18.04.2-fix-sftp-links.patch b/kde-apps/kio-extras/files/kio-extras-18.04.2-fix-sftp-links.patch
new file mode 100644
index 000000000000..8f7c02338794
--- /dev/null
+++ b/kde-apps/kio-extras/files/kio-extras-18.04.2-fix-sftp-links.patch
@@ -0,0 +1,227 @@
+From bca40518682a038aa08823fbbfb2cc4b9ef63802 Mon Sep 17 00:00:00 2001
+From: Jaime Torres <jtamate@gmail.com>
+Date: Wed, 13 Jun 2018 19:21:34 +0200
+Subject: fix sftp links with new uds implementation
+
+Summary:
+When listening a directory with links in sftp, the type of the entry of a symlink was inserted twice.
+Now the entry data is inserted only once.
+Get rid of the goto statement using local variables.
+
+Test Plan: Tested in sftp://127.0.0.1 with broken symbolic links and sftp://127.0.0.1/usr/lib64 with a lot of symbolic links.
+
+Reviewers: dfaure, martinkostolny, asturmlechner, lbeltrame, bruns
+
+Reviewed By: dfaure, martinkostolny
+
+Differential Revision: https://phabricator.kde.org/D13475
+---
+ sftp/kio_sftp.cpp | 129 ++++++++++++++++++++++++++++--------------------------
+ 1 file changed, 67 insertions(+), 62 deletions(-)
+
+diff --git a/sftp/kio_sftp.cpp b/sftp/kio_sftp.cpp
+index 0a82365..f515458 100644
+--- a/sftp/kio_sftp.cpp
++++ b/sftp/kio_sftp.cpp
+@@ -342,6 +342,9 @@ bool sftpProtocol::createUDSEntry(const QString &filename, const QByteArray &pat
+ mode_t type;
+ mode_t access;
+ char *link;
++ bool isBrokenLink = false;
++ long long fileType = S_IFREG;
++ long long size = 0LL;
+
+ Q_ASSERT(entry.count() == 0);
+
+@@ -353,54 +356,53 @@ bool sftpProtocol::createUDSEntry(const QString &filename, const QByteArray &pat
+ entry.insert(KIO::UDSEntry::UDS_NAME, filename);
+
+ if (sb->type == SSH_FILEXFER_TYPE_SYMLINK) {
+- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
+ link = sftp_readlink(mSftp, path.constData());
+ if (link == nullptr) {
+ sftp_attributes_free(sb);
+ return false;
+ }
+ entry.insert(KIO::UDSEntry::UDS_LINK_DEST, QFile::decodeName(link));
+- delete link;
++ free(link);
+ // A symlink -> follow it only if details > 1
+ if (details > 1) {
+ sftp_attributes sb2 = sftp_stat(mSftp, path.constData());
+ if (sb2 == nullptr) {
+- // It is a link pointing to nowhere
+- type = S_IFMT - 1;
+- access = S_IRWXU | S_IRWXG | S_IRWXO;
+- entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, type);
+- entry.insert( KIO::UDSEntry::UDS_ACCESS, access);
+- entry.insert( KIO::UDSEntry::UDS_SIZE, 0LL );
+-
+- goto notype;
++ isBrokenLink = true;
++ } else {
++ sftp_attributes_free(sb);
++ sb = sb2;
+ }
+- sftp_attributes_free(sb);
+- sb = sb2;
+ }
+ }
+
+- switch (sb->type) {
+- case SSH_FILEXFER_TYPE_REGULAR:
+- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
+- break;
+- case SSH_FILEXFER_TYPE_DIRECTORY:
+- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
+- break;
+- case SSH_FILEXFER_TYPE_SYMLINK:
+- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFLNK);
+- break;
+- case SSH_FILEXFER_TYPE_SPECIAL:
+- case SSH_FILEXFER_TYPE_UNKNOWN:
+- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFMT - 1);
+- break;
++ if (isBrokenLink) {
++ // It is a link pointing to nowhere
++ fileType = S_IFMT - 1;
++ access = S_IRWXU | S_IRWXG | S_IRWXO;
++ size = 0LL;
++ } else {
++ switch (sb->type) {
++ case SSH_FILEXFER_TYPE_REGULAR:
++ fileType = S_IFREG;
++ break;
++ case SSH_FILEXFER_TYPE_DIRECTORY:
++ fileType = S_IFDIR;
++ break;
++ case SSH_FILEXFER_TYPE_SYMLINK:
++ fileType = S_IFLNK;
++ break;
++ case SSH_FILEXFER_TYPE_SPECIAL:
++ case SSH_FILEXFER_TYPE_UNKNOWN:
++ fileType = S_IFMT - 1;
++ break;
++ }
++ access = sb->permissions & 07777;
++ size = sb->size;
+ }
+-
+- access = sb->permissions & 07777;
++ entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, fileType);
+ entry.insert(KIO::UDSEntry::UDS_ACCESS, access);
++ entry.insert( KIO::UDSEntry::UDS_SIZE, size);
+
+- entry.insert(KIO::UDSEntry::UDS_SIZE, sb->size);
+-
+-notype:
+ if (details > 0) {
+ if (sb->owner) {
+ entry.insert(KIO::UDSEntry::UDS_USER, QString::fromUtf8(sb->owner));
+@@ -419,6 +421,7 @@ notype:
+ entry.insert(KIO::UDSEntry::UDS_CREATION_TIME, sb->createtime);
+ }
+
++
+ sftp_attributes_free(sb);
+
+ return true;
+@@ -1830,6 +1833,9 @@ void sftpProtocol::listDir(const QUrl& url) {
+ mode_t access;
+ mode_t type;
+ char *link;
++ bool isBrokenLink = false;
++ long long fileType = S_IFREG;
++ long long size = 0LL;
+
+ dirent = sftp_readdir(mSftp, dp);
+ if (dirent == nullptr) {
+@@ -1842,8 +1848,6 @@ void sftpProtocol::listDir(const QUrl& url) {
+ if (dirent->type == SSH_FILEXFER_TYPE_SYMLINK) {
+ QByteArray file = path + '/' + QFile::decodeName(dirent->name).toUtf8();
+
+- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
+-
+ link = sftp_readlink(mSftp, file.constData());
+ if (link == nullptr) {
+ sftp_attributes_free(dirent);
+@@ -1851,46 +1855,47 @@ void sftpProtocol::listDir(const QUrl& url) {
+ return;
+ }
+ entry.insert(KIO::UDSEntry::UDS_LINK_DEST, QFile::decodeName(link));
+- delete link;
++ free(link);
+ // A symlink -> follow it only if details > 1
+ if (details > 1) {
+ sftp_attributes sb = sftp_stat(mSftp, file.constData());
+ if (sb == nullptr) {
+- // It is a link pointing to nowhere
+- type = S_IFMT - 1;
+- access = S_IRWXU | S_IRWXG | S_IRWXO;
+- entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, type);
+- entry.insert( KIO::UDSEntry::UDS_ACCESS, access);
+- entry.insert( KIO::UDSEntry::UDS_SIZE, 0LL );
+-
+- goto notype;
++ isBrokenLink = true;
++ } else {
++ sftp_attributes_free(dirent);
++ dirent = sb;
+ }
+- sftp_attributes_free(dirent);
+- dirent = sb;
+ }
+ }
+
+- switch (dirent->type) {
+- case SSH_FILEXFER_TYPE_REGULAR:
+- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
+- break;
+- case SSH_FILEXFER_TYPE_DIRECTORY:
+- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
+- break;
+- case SSH_FILEXFER_TYPE_SYMLINK:
+- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFLNK);
+- break;
+- case SSH_FILEXFER_TYPE_SPECIAL:
+- case SSH_FILEXFER_TYPE_UNKNOWN:
+- break;
+- }
++ if (isBrokenLink) {
++ // It is a link pointing to nowhere
++ fileType = S_IFMT - 1;
++ access = S_IRWXU | S_IRWXG | S_IRWXO;
++ size = 0LL;
++ } else {
++ switch (dirent->type) {
++ case SSH_FILEXFER_TYPE_REGULAR:
++ fileType = S_IFREG;
++ break;
++ case SSH_FILEXFER_TYPE_DIRECTORY:
++ fileType = S_IFDIR;
++ break;
++ case SSH_FILEXFER_TYPE_SYMLINK:
++ fileType = S_IFLNK;
++ break;
++ case SSH_FILEXFER_TYPE_SPECIAL:
++ case SSH_FILEXFER_TYPE_UNKNOWN:
++ break;
++ }
+
+- access = dirent->permissions & 07777;
++ access = dirent->permissions & 07777;
++ size = dirent->size;
++ }
++ entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, fileType);
+ entry.insert(KIO::UDSEntry::UDS_ACCESS, access);
++ entry.insert(KIO::UDSEntry::UDS_SIZE, size);
+
+- entry.insert(KIO::UDSEntry::UDS_SIZE, dirent->size);
+-
+-notype:
+ if (details > 0) {
+ if (dirent->owner) {
+ entry.insert(KIO::UDSEntry::UDS_USER, QString::fromUtf8(dirent->owner));
+--
+cgit v0.11.2
+
diff --git a/kde-apps/kio-extras/kio-extras-18.04.2-r1.ebuild b/kde-apps/kio-extras/kio-extras-18.04.2-r1.ebuild
new file mode 100644
index 000000000000..9ba190026570
--- /dev/null
+++ b/kde-apps/kio-extras/kio-extras-18.04.2-r1.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+KDE_HANDBOOK="forceoptional"
+KDE_TEST="optional"
+VIRTUALX_REQUIRED="test"
+inherit kde5
+
+DESCRIPTION="KIO plugins present a filesystem-like view of arbitrary data"
+HOMEPAGE="https://cgit.kde.org/kio-extras.git"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+IUSE="activities htmlthumbs +man mtp openexr phonon samba +sftp taglib"
+
+COMMON_DEPEND="
+ $(add_frameworks_dep karchive 'bzip2,lzma')
+ $(add_frameworks_dep kbookmarks)
+ $(add_frameworks_dep kcodecs)
+ $(add_frameworks_dep kconfig)
+ $(add_frameworks_dep kconfigwidgets)
+ $(add_frameworks_dep kcoreaddons)
+ $(add_frameworks_dep kdbusaddons)
+ $(add_frameworks_dep kdnssd)
+ $(add_frameworks_dep kguiaddons)
+ $(add_frameworks_dep ki18n)
+ $(add_frameworks_dep kiconthemes)
+ $(add_frameworks_dep kio)
+ $(add_frameworks_dep kparts)
+ $(add_frameworks_dep kpty)
+ $(add_frameworks_dep kservice)
+ $(add_frameworks_dep kxmlgui)
+ $(add_frameworks_dep solid)
+ $(add_qt_dep qtdbus)
+ $(add_qt_dep qtgui)
+ $(add_qt_dep qtnetwork)
+ $(add_qt_dep qtsvg)
+ $(add_qt_dep qtwidgets)
+ $(add_qt_dep qtxml)
+ activities? (
+ $(add_frameworks_dep kactivities)
+ $(add_qt_dep qtsql)
+ )
+ htmlthumbs? ( $(add_qt_dep qtwebengine 'widgets') )
+ man? ( $(add_frameworks_dep khtml) )
+ mtp? ( media-libs/libmtp:= )
+ openexr? ( media-libs/openexr )
+ phonon? ( media-libs/phonon[qt5(+)] )
+ samba? ( net-fs/samba[client] )
+ sftp? ( net-libs/libssh:=[sftp] )
+ taglib? ( >=media-libs/taglib-1.11.1 )
+"
+RDEPEND="${COMMON_DEPEND}
+ $(add_frameworks_dep kded)
+"
+DEPEND="${COMMON_DEPEND}
+ x11-misc/shared-mime-info
+ man? ( dev-util/gperf )
+"
+
+# requires running kde environment
+RESTRICT+=" test"
+
+PATCHES=( "${FILESDIR}/${P}-fix-sftp-links.patch" )
+
+src_configure() {
+ local mycmakeargs=(
+ $(cmake-utils_use_find_package activities KF5Activities)
+ $(cmake-utils_use_find_package htmlthumbs Qt5WebEngineWidgets)
+ $(cmake-utils_use_find_package man Gperf)
+ $(cmake-utils_use_find_package mtp Mtp)
+ $(cmake-utils_use_find_package openexr OpenEXR)
+ $(cmake-utils_use_find_package phonon Phonon4Qt5)
+ $(cmake-utils_use_find_package samba Samba)
+ $(cmake-utils_use_find_package sftp LibSSH)
+ $(cmake-utils_use_find_package taglib Taglib)
+ )
+
+ kde5_src_configure
+}