Should Files.createDirectory allow setting of group and other permissions?
Alan Bateman
Alan.Bateman at oracle.com
Fri Aug 5 05:57:43 PDT 2011
Tim Fox wrote:
> Yeah, my umask prevents the write bit being set by the process for
> group and others, however is it right for Files.createDirectory() to
> silently fail to create the directory with the specified permissions,
> rather than throw an exception?
>
> If that's expected behaviour, that's fine.
Yes, it is expected and I don't think it would be feasible to do it any
other way (because that would make the create* operations non-atomic and
would involve throwing an exception after the file has been created).
Here's how it's worded in the docs:
"Where an implementation supports the setting of the access permissions,
and the underlying file system supports access permissions, then it is
required that the value of the actual access permissions will be equal
or less than the value of the attribute provided to the createFile or
createDirectory methods. In other words, the file may be more secure
than requested."
-Alan.
More information about the nio-discuss
mailing list