Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Filesystem perms on Windows
From: Gavin Lambert (boost_at_[hidden])
Date: 2018-12-06 02:46:00

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 list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at