Bug 1970 - new Mono.Unix.UnixDirectoryInfo("1").Create(FileAccessPermissions.AllPermissions); does not set the permission
Summary: new Mono.Unix.UnixDirectoryInfo("1").Create(FileAccessPermissions.AllPermissi...
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.POSIX ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2011-11-09 09:46 UTC by Kirill
Modified: 2012-08-07 15:43 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Kirill 2011-11-09 09:46:45 UTC
Mono.Unix.UnixDirectoryInfo("1").Create(FileAccessPermissions.AllPermissions); does not set the permission

but this code

UnixDirectoryInfo ud = new UnixDirectoryInfo("1");
ud.FileAccessPermissions = FileAccessPermissions.AllPermissions;

is working
Comment 1 Robert Wilkens 2012-06-22 09:28:23 UTC
This is a result of the mkdir system call honoring umask, from what i can see.  Should it?

For example, I ran your sample code, modified so it compiles, and the result was:

drwxrwxr-x 2 robwilkens robwilkens   4096 Jun 22 09:22 1

and i presume you were expecting

drwxrwxrwx permissions

From the command prompt if i type 'umask' I get back 0002, which is why the other 'write' bit isn't set.

If as the user before running your sample code, from the command prompt, i type:

~/monotests$ umask 0000
~/monotests$ ./test8.exe
~/monotests$ ls -ld 1
drwxrwxrwx 2 robwilkens robwilkens 4096 Jun 22 09:25 1
Comment 2 Jonathan Pryor 2012-08-07 15:43:53 UTC
UnixDirectoryInfo.Create() should follow umask, as that's what Syscall.mkdir() does, and the documentation has a "see also" ref to the Syscall.mkdir() docs.

Docs updated in 43955e80.