Sandbox denials for NSTextView

Number:rdar://10632730 Date Originated:12/30/2011
Status:Duplicate Resolved:No
Product:Mac OS X Product Version:10.7.2
Classification:Serious Bug Reproducible:Always
NSTextView uses a global preference file outside of the sandbox, which it is denied access to on Lion. This causes decreased functionality, including no way to manage text styles, as well as lots of log messages as it tries over and over to access the file.

Steps to Reproduce:
1) Add an NSTextView to any application
2) Sandbox it (add any entitlement you like, none of them help except the temporary read-write ones)
3) Run the application
4) Check the system log file. You'll already see several messages along the lines of:
Dec 30 13:13:12 fruitbook sandboxd[99440] ([99412]): Pear Note(99412) deny file-write-create /Users/chad/Library/Preferences/ByHost/.GlobalPreferences.2E0EEAA4-523A-56D9-A2D9-72B9838F06EB.plist.Dg6V7nX
5) In your application, attempt to add a new favorite style (or delete one if you'd rather)
6) Notice more deny file-write-create messages in the log file
7) Quit and relaunch your application
8) View your favorite styles. The one you created is not there (as it was never written to disk).

Expected Results:
NSTextView should not cause sandbox denials requiring full file system access. NSTextView should be able to save styles while sandboxed.

Actual Results:
Lots of denials and non-working functionality.

This worked without sandboxes.

This is related to rdar://10385163 as TextEdit is a sandboxed application which uses NSTextView. So, if you're looking for sample code, TextEdit is likely a good choice.


Closed as a dup

This bug was just closed as a dup of rdar://10385163

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!