Bug 33209 - Machine registry is broken on Mac
Summary: Machine registry is broken on Mac
Status: RESOLVED INVALID
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 4.2.0 (C6)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Miguel de Icaza [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-08-18 18:15 UTC by Marius Ungureanu
Modified: 2015-08-20 10:19 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED INVALID

Description Marius Ungureanu 2015-08-18 18:15:55 UTC
Given that the machine.config file is here:

/Library/Frameworks/Mono.framework/Versions/4.2.0/lib/../etc/mono/4.5/machine.config

And we have this path substitution:

https://github.com/mono/mono/blob/master/mcs/class/corlib/Microsoft.Win32/UnixRegistryApi.cs#L820-L822

It means that on Mac the global registry store points to:

/Library/Frameworks/Mono.framework/Versions/4.2.0/lib/../etc/mono/4.5/../registry

Which:

1) Doesn't exist, so it can't be created by mono, because of no-sudo.
2) Even if created, doing chmod 777 on it won't be nice.

This literally breaks all registry key usage from the local machine hive.
Comment 1 Miguel de Icaza [MSFT] 2015-08-19 11:01:15 UTC
I do not follow, the actual path does exit (modulo the version number):

The resolved path is:

/Library/Frameworks/Mono.framework/Versions/VERSION/etc/mono/registry
Comment 2 Marius Ungureanu 2015-08-19 11:26:20 UTC
Okay, it seems that one of my machines is broken, the other is fine and has the directory.

The issue at hand is that we cannot create registry keys under that folder:

➜  Work  ls -lh /Library/Frameworks/Mono.framework/Versions/Current/etc/mono/registry
total 8
drwxr-xr-x  2 root  admin    68B Jun  5 21:19 LocalMachine
-rw-r--r--  1 root  admin     3B Jun  9 21:48 last-btime
➜  Work  ls -lh /Library/Frameworks/Mono.framework/Versions/Current/etc/mono
total 624
drwxr-xr-x  7 root  admin   238B Jun 12 01:57 2.0
drwxr-xr-x  7 root  admin   238B Jun 12 01:57 4.0
drwxr-xr-x  7 root  admin   238B Jun 12 01:57 4.5
-rw-r--r--  1 root  admin   305K Jun 12 01:57 browscap.ini
-rw-r--r--  1 root  admin   2.5K Jun 12 02:09 config
drwxr-xr-x  3 root  admin   102B Jun 12 01:58 mconfig
drwxr-xr-x  4 root  admin   136B Jun  5 21:59 registry

Unless we're doing sudo, which is probably not something that's wanted? It's probably not just an El Capitan issue.
Comment 3 Miguel de Icaza [MSFT] 2015-08-19 11:29:02 UTC
I hope you are not using the registry API for Xamarin Studio ;-)

It seems fine to have that directory be protected and not accessible to non-root users.
Comment 4 Marius Ungureanu 2015-08-20 07:58:20 UTC
This is not a showstopper for me, and it is not really important. Just thought it should be noted somewhere that machine registries don't work because of permissions/sudo/whatever is needed.

I fixed it locally for me.
Comment 5 Miguel de Icaza [MSFT] 2015-08-20 10:19:42 UTC
I do not think that they are broken, you just have no rights to make changes to them, unless you have super user permissions.

Otherwise, any user could make changes to the keys, and that is not the intended behavior.  

The only guarantees that non-administrative users have over the keys they can change are user keys, not machine keys.