Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Filesystem perms on Windows
From: Lars (laasunde_at_[hidden])
Date: 2018-12-07 13:12:27


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 <boost-users-bounces_at_[hidden]> på vegne av Gavin Lambert via Boost-users <boost-users_at_[hidden]>
Sendt: torsdag 6. desember 2018 03.46
Til: boost-users_at_[hidden]
Kopi: Gavin Lambert
Emne: Re: [Boost-users] Boost.Filesystem perms on Windows

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
   - 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
Boost-users mailing list

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at