Boost logo

Boost :

Subject: Re: [boost] [filesystem]Setting permissions/chmod
From: Beman Dawes (bdawes_at_[hidden])
Date: 2008-10-13 08:24:05


On Mon, Oct 13, 2008 at 4:46 AM, Johan Torp <johan.torp_at_[hidden]> wrote:

>
> After looking through boost.filesystem's documentation and code, I can't
> find
> anything about permissions. I assume boost.filesystem has not implemented
> this because it aims to be portable and POSIX style permissions isn't
> applicable on all operating systems. Am I correct?

Yes. I've tried a couple of times to research implementing POSIX style
permissions on Windows, but quickly got lost in the complexities of the
Win32 permissions and ownership scheme. I know it can be done for
permissions, because Cygwin does it.

Just last week I had an email exchange with Bjarne Stroustrup on the topic.
He asked us to explore the possibility of providing a non-portable approach
if a portable approach wasn't possible.

He asked about providing a function (or functions) that could be adapted to
various operating systems. Perhaps something like:

      void set_permissions( const path & p, const permissions & perms );
      void set_ownership( const path & p, const ownership & owners );

Where permissions and ownership are implementation-defined.

* On POSIX, permission would mimic the chmod arguments, ownership would
mimic chown arguments.
* On Windows, permission and ownership would be something appropriate for
Windows.

(The above is just thinking out loud, not a serious proposal.)

I'm not opposed to providing system specific features for Boost.Filesystem,
but would like to explore the alternatives first. A starting point might be
to try to independently define permissions and ownership for POSIX and
Windows, and then try to see if there is any commonality. I'd need some help
from folks who understand the Windows permissions and ownership model.

Thoughts?

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk