2018-05-04 19:49:47 +02:00
|
|
|
From 3640475b0a8ea4a2eca060ed0bcf1f8f8da22375 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Wolfgang Bauer <wbauer@tmo.at>
|
|
|
|
Date: Fri, 4 May 2018 16:22:57 +0200
|
|
|
|
Subject: [PATCH] Revert "Support NTFS hidden files"
|
|
|
|
|
|
|
|
This reverts commit d7cce9937d5e9af2753fadb82d11f308b58bb8fa.
|
|
|
|
|
|
|
|
The new support for NTFS hidden files causes the mountpoint itself
|
|
|
|
to be hidden as well, apparently the root directory of an NTFS
|
|
|
|
partition always has the "hidden" attribute set.
|
|
|
|
|
|
|
|
https://bugs.kde.org/show_bug.cgi?id=392913
|
|
|
|
http://bugzilla.opensuse.org/show_bug.cgi?id=1091780
|
|
|
|
---
|
|
|
|
src/ioslaves/file/file_unix.cpp | 54 -----------------------------------------
|
|
|
|
1 file changed, 54 deletions(-)
|
|
|
|
|
2018-07-17 10:58:01 +02:00
|
|
|
Index: kio-5.48.0git.20180707T215251~1fa87fdd/src/ioslaves/file/file_unix.cpp
|
|
|
|
===================================================================
|
|
|
|
--- kio-5.48.0git.20180707T215251~1fa87fdd.orig/src/ioslaves/file/file_unix.cpp
|
|
|
|
+++ kio-5.48.0git.20180707T215251~1fa87fdd/src/ioslaves/file/file_unix.cpp
|
|
|
|
@@ -38,9 +38,6 @@
|
2018-05-04 19:49:47 +02:00
|
|
|
#include <kmountpoint.h>
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
-#if HAVE_SYS_XATTR_H
|
|
|
|
-#include <sys/xattr.h>
|
|
|
|
-#endif
|
|
|
|
#include <utime.h>
|
|
|
|
|
|
|
|
#include <KAuth>
|
2018-07-17 10:58:01 +02:00
|
|
|
@@ -416,52 +413,6 @@ static bool isLocalFileSameHost(const QU
|
2018-05-04 19:49:47 +02:00
|
|
|
return (QString::compare(url.host(), QLatin1String(hostname), Qt::CaseInsensitive) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
-#if HAVE_SYS_XATTR_H
|
|
|
|
-static bool isNtfsHidden(const QString &filename)
|
|
|
|
-{
|
|
|
|
- constexpr auto attrName = "system.ntfs_attrib_be";
|
|
|
|
- const auto filenameEncoded = QFile::encodeName(filename);
|
2018-05-15 14:58:24 +02:00
|
|
|
-#ifdef Q_OS_MACOS
|
|
|
|
- auto length = getxattr(filenameEncoded.data(), attrName, nullptr, 0, 0, XATTR_NOFOLLOW);
|
|
|
|
-#else
|
2018-05-04 19:49:47 +02:00
|
|
|
- auto length = getxattr(filenameEncoded.data(), attrName, nullptr, 0);
|
2018-05-15 14:58:24 +02:00
|
|
|
-#endif
|
2018-05-04 19:49:47 +02:00
|
|
|
- if (length <= 0) {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- constexpr size_t xattr_size = 1024;
|
|
|
|
- char strAttr[xattr_size];
|
2018-05-15 14:58:24 +02:00
|
|
|
-#ifdef Q_OS_MACOS
|
|
|
|
- length = getxattr(filenameEncoded.data(), attrName, strAttr, xattr_size, 0, XATTR_NOFOLLOW);
|
|
|
|
-#else
|
2018-05-04 19:49:47 +02:00
|
|
|
- length = getxattr(filenameEncoded.data(), attrName, strAttr, xattr_size);
|
2018-05-15 14:58:24 +02:00
|
|
|
-#endif
|
2018-05-04 19:49:47 +02:00
|
|
|
- if (length <= 0) {
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Decode result to hex string
|
|
|
|
- static constexpr auto digits = "0123456789abcdef";
|
|
|
|
- QVarLengthArray<char> hexAttr(static_cast<int>(length) * 2 + 4);
|
|
|
|
- char *c = strAttr;
|
|
|
|
- char *e = hexAttr.data();
|
|
|
|
- *e++ ='0';
|
|
|
|
- *e++ = 'x';
|
|
|
|
- for (auto n = 0; n < length; n++, c++) {
|
|
|
|
- *e++ = digits[(static_cast<uchar>(*c) >> 4)];
|
|
|
|
- *e++ = digits[(static_cast<uchar>(*c) & 0x0F)];
|
|
|
|
- }
|
|
|
|
- *e = '\0';
|
|
|
|
-
|
|
|
|
- // Decode hex string to int
|
|
|
|
- auto intAttr = static_cast<uint>(strtol(hexAttr.data(), nullptr, 16));
|
|
|
|
-
|
|
|
|
- constexpr auto FILE_ATTRIBUTE_HIDDEN = 0x2u;
|
|
|
|
- return static_cast<bool>(intAttr & FILE_ATTRIBUTE_HIDDEN);
|
|
|
|
-}
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-
|
|
|
|
void FileProtocol::listDir(const QUrl &url)
|
|
|
|
{
|
|
|
|
if (!isLocalFileSameHost(url)) {
|
2018-07-17 10:58:01 +02:00
|
|
|
@@ -558,11 +509,6 @@ void FileProtocol::listDir(const QUrl &u
|
2018-05-04 19:49:47 +02:00
|
|
|
|
|
|
|
} else {
|
|
|
|
if (createUDSEntry(filename, QByteArray(ep->d_name), entry, details)) {
|
|
|
|
-#if HAVE_SYS_XATTR_H
|
|
|
|
- if (isNtfsHidden(filename)) {
|
2018-07-17 10:58:01 +02:00
|
|
|
- entry.fastInsert(KIO::UDSEntry::UDS_HIDDEN, 1);
|
2018-05-04 19:49:47 +02:00
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
listEntry(entry);
|
|
|
|
}
|
|
|
|
}
|