[filesystem]Setting permissions/chmod

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? Best Regards, Johan Torp www.johantorp.com -- View this message in context: http://www.nabble.com/-filesystem-Setting-permissions-chmod-tp19950894p19950... Sent from the Boost - Dev mailing list archive at Nabble.com.

On Mon, Oct 13, 2008 at 4:46 AM, Johan Torp <johan.torp@gmail.com> 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

Beman Dawes wrote:
On Mon, Oct 13, 2008 at 4:46 AM, Johan Torp <johan.torp@gmail.com> 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.
Note: 'NT ACLs are unable to reflect each possible combination of POSIX permissions' http://cygwin.com/cygwin-ug-net/ntsec.html
[snip]

Hi Beman Dawes wrote:
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.
I believe security is so important that it can not be fully left to the implementator. There are several other libraries that could benefit from a well defined security model, such as asio and interprocess. On the other hand a portable definition is very hard to obtain. Portability issues include not only platforms but file systems as well, as is the case with other file attributes. Perhaps a minimal set of constructors should be specified for security objects covering the most common cases and allowing for more implementation defined constructors. IMHO security deserves its own library, defining concepts such as users, groups, acls, execution context, etc. Unfortunately I currently don't have the time to come up with a serious proposal :-( Best regards Jorge

Beman Dawes wrote:
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?
I think there would be a lot of value in having the functionality in boost. I can't even guess what the interfaces would look like since it's such a complex domain and I lack good understanding of windows security model. Starting out with two separate implementations might work. Something like boost::filesystem::win32 and boost::filesystem::posix which can later on be deprecated if common abstractions are found. It would be good to have some "live" library fast, maybe it can be setup as an external library which aims for a later inclusion in boost once it's matured. In general, I think it would be very beneficial for many libraries if there was some kind of packaged preliminary step before acceptance into boost. Libraries in the preliminary stage would have more lax requirements and moving interfaces but should still be fairly well tested. Perhaps they could be packaged and released individually and that work burden could be placed on the authors - boost would just provide some framework for doing so and link to the preliminaries from the download and doc pages of www.boost.org. Finding things in the sandbox and vault is a big threshold for most users. Johan www.johantorp.com -- View this message in context: http://www.nabble.com/-filesystem-Setting-permissions-chmod-tp19950894p19959... Sent from the Boost - Dev mailing list archive at Nabble.com.
participants (4)
-
Beman Dawes
-
Ilya Sokolov
-
Johan Torp
-
Jorge Lodos Vigil