Hello, The documentationhttps://www.boost.org/doc/libs/1_68_0/libs/filesystem/doc/reference.html#Enu... (boost version 1.68) for boost::filesystem::perms enumerator says; "Windows: All permissions except write are currently ignored. There is only a single write permission; setting write permission for owner, group, or others sets write permission for all, and removing write permission for owner, group, or others removes write permission for all." Does "All permissions except write are currently ignored" restriction apply to both getting permission from a file and setting permission to a file? In other words, does it apply to both boost::filesystem::status(..) and boost::filesystem::permissions(..) methods? Why does the fileysystem have this restriction? Is this some limitation in the design or a bug or missing feature? Kind regards, Lars
On 6/12/2018 08:29, Lars wrote:
/"Windows: All permissions except write are currently ignored. There is only a single write permission; setting write permission for owner, group, or others sets write permission for all, and removing write permission for owner, group, or others removes write permission for all."/ / / Does "/All permissions except write are currently ignored" /restriction apply to both getting permission from a file and setting permission to a file? In other words, does it apply to both boost::filesystem::status(..) and boost::filesystem::permissions(..) methods?
Why does the fileysystem have this restriction? Is this some limitation in the design or a bug or missing feature?
Boost.Filesystem maps the "permissions" to the read-only file attribute, presumably because that's simpler and somewhat analogous to the Posix permission attribute bits. Both platforms also support more complex ACL permissions (although in Posix it's optional) but these are not exposed via Boost.Filesystem. The actual logic for getting the file permission on Windows is approximately: - the read bits are always set - the write bits are set if the read-only attribute is not set - the execute bits are set if the file extension is one of ".exe", ".com", ".bat", or ".cmd". (which is wrong, but probably few apps care.) When changing the permissions, it merely sets or clears the read-only attribute.
Gavin,
Appreciate the response.
In your response you say "the read bits are always set" - is that based on read-only attribute or Windows permission settings?
I appreciate this might be complicated but the Windows implementation of permissions is rather surprising and not comparable to viewing "Security" on a file in Windows Explorer. Maybe a more visible and clearer description of permissions in the documentation is in order. I have certainly spent hours trying to use permissions with an incorrect view of its functionality 😊
kind regards, Lars
________________________________
Fra: Boost-users
/"Windows: All permissions except write are currently ignored. There is only a single write permission; setting write permission for owner, group, or others sets write permission for all, and removing write permission for owner, group, or others removes write permission for all."/ / / Does "/All permissions except write are currently ignored" /restriction apply to both getting permission from a file and setting permission to a file? In other words, does it apply to both boost::filesystem::status(..) and boost::filesystem::permissions(..) methods?
Why does the fileysystem have this restriction? Is this some limitation in the design or a bug or missing feature?
Boost.Filesystem maps the "permissions" to the read-only file attribute, presumably because that's simpler and somewhat analogous to the Posix permission attribute bits. Both platforms also support more complex ACL permissions (although in Posix it's optional) but these are not exposed via Boost.Filesystem. The actual logic for getting the file permission on Windows is approximately: - the read bits are always set - the write bits are set if the read-only attribute is not set - the execute bits are set if the file extension is one of ".exe", ".com", ".bat", or ".cmd". (which is wrong, but probably few apps care.) When changing the permissions, it merely sets or clears the read-only attribute. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
On 8/12/2018 02:12, Lars wrote:
In your response you say "the read bits are always set" - is that based on read-only attribute or Windows permission settings?
No. They are always set. They are never not returned. A file with the read-only attribute set is reported as "readable but not writable" by Boost.Filesystem. A file with it not set is reported as "readable and writable".
I appreciate this might be complicated but the Windows implementation of permissions is rather surprising and not comparable to viewing "Security" on a file in Windows Explorer. Maybe a more visible and clearer description of permissions in the documentation is in order. I have certainly spent hours trying to use permissions with an incorrect view of its functionality 😊
Boost.Filesystem does not model ACL permissions at all (neither for Windows nor for Linux). You will have to use native APIs for that. The "Security" tab in Windows are the ACL permissions.
participants (2)
-
Gavin Lambert
-
Lars