Bug 365795 - Setting extended permissions do not work
Summary: Setting extended permissions do not work
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.23.0
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 366177 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-07-17 20:50 UTC by Martin
Modified: 2017-08-15 16:55 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin 2016-07-17 20:50:00 UTC
Open properties dialog for a folder. Then open extended permissions dialog. Set option "GID" and press OK.
Result: GID bit is not set. If GID bit was set before it will be cleared.

Reproducible: Always
Comment 1 Martin 2016-07-17 20:57:16 UTC
Example:
Folder test has user foo and group bar.
In a terminal: chmod g+s test
Open properties dialog in dolphin for test as normal user. Open extended permissions dialog. The GID is shown unchecked.
Start dolphin with kdesudo. Open properties dialog for test. Open extended permissions dialog. GID option is shown checked. Leave it checked and press OK and press OK again. Then check in terminal->GID bit is cleared.
Comment 2 Tony 2016-07-27 07:48:23 UTC
Can confirm this one. Present on KDE Neon 5.7.2, Dolphin ver.16.04.3
Comment 3 Emmanuel Pescosta 2016-07-27 07:52:09 UTC
Thanks for the bug report!

Can you please tell us your KDE Frameworks version?
Comment 4 Martin 2016-07-27 11:44:22 UTC
plasma-framework 5.23.0-0ubuntu1~ubuntu16.04~ppa1
Comment 5 Emmanuel Pescosta 2016-07-27 18:01:21 UTC
(In reply to Martin from comment #4)
> plasma-framework 5.23.0-0ubuntu1~ubuntu16.04~ppa1

Thanks! 
I'll reassign it to KIO because the properties dialog is provided by KIO.
Comment 6 Emmanuel Pescosta 2016-07-27 18:08:03 UTC
Looks similar to bug 366177
Comment 7 Kai Uwe Broulik 2017-08-15 11:30:35 UTC
*** Bug 366177 has been marked as a duplicate of this bug. ***
Comment 8 Kai Uwe Broulik 2017-08-15 12:01:40 UTC
Ok, I found it. The bug is actually in the file:/ KIO slave.

It does QFile::setPermissions and has a modeToQFilePermissions which converts POSIX flags like S_IRUSR to QFile::ReadOwner.

Unfortunately, it nowhere takes into account S_ISVTX and other special attributes so they get lost. Wpw. I also don't see a way to do this with QFile.
Comment 9 Kai Uwe Broulik 2017-08-15 12:18:36 UTC
Patch https://phabricator.kde.org/D7230
Comment 10 Gabriel C 2017-08-15 12:27:29 UTC
you meant https://phabricator.kde.org/D7326 ?:)
Comment 11 Kai Uwe Broulik 2017-08-15 12:29:20 UTC
Of course :) thanks
Comment 12 Kai Uwe Broulik 2017-08-15 12:42:04 UTC
Git commit 9ac7832b859bfcbc88448c4ae0f6dc14b2d54a06 by Kai Uwe Broulik.
Committed on 15/08/2017 at 12:41.
Pushed by broulik into branch 'master'.

[File KIO slave] Fix applying special file attributes

QFile does not support special attributes like sticky. This would cause us to always discard them.

Differential Revision: https://phabricator.kde.org/D7326

M  +20   -0    autotests/jobtest.cpp
M  +3    -0    autotests/jobtest.h
M  +5    -0    src/ioslaves/file/file.cpp

https://commits.kde.org/kio/9ac7832b859bfcbc88448c4ae0f6dc14b2d54a06
Comment 13 Don Curtis 2017-08-15 16:40:38 UTC
AFAIK, Qt doesn't provide any functionality to handle UNIX (and therefore also Linux) extended file attributes.

Therefore, AFAIK, for the case of UNIX, Apple MAC and Linux (and Android?), the extended file attributes (file metadata) can only be managed by means of the (C library) system calls dealing with file metadata management -- the 'stat' and 'chmod' system call families.
Comment 14 Kai Uwe Broulik 2017-08-15 16:55:05 UTC
I ifdef'd it using ::chmod for UNIX, didn't check whether this actually covers Mac but in any case better than the status quo.