Sandboxed app cannot launch apps not yet launched by the user

Originator:adamnhjl
Number:rdar://10934199 Date Originated:26-Feb-2012 02:30 PM
Status:Open Resolved:
Product:Mac PS X Product Version:10.8DP1/12A128p
Classification:Serious Bug Reproducible:Always
 
Summary: A sandboxed application cannot launch other applications that have not been launched manually by the user. The issue applies to both OS X 10.7.3 and 10.8DP1 when Gate Keeper is off (i.e. set to from Anywhere).

Steps to Reproduce:

1. Create an application A and put it somewhere (in /Applications, in the user directory, does not seem to matter) so that the full path to application is some APPLICATIONAPATH. Do not launch it manually.

2. Create a sandboxed application B that contains this code:

	NSError*	error	= nil;
	NSRunningApplication*	app = [[NSWorkspace sharedWorkspace] launchApplicationAtURL: [NSURL fileURLWithPath: APPLICATIONAPATH]
		options: NSWorkspaceLaunchDefault
		configuration: nil
		error: &error ];

3. Run the sandboxed application B.

Expected Results: The method should launch the application returning a valid NSRunningApplication instance and no error.

Actual Results: The method does not launch the application returning nil and setting error to this:

Error Domain=NSCocoaErrorDomain Code=3584 "The application “APPANAME” could not be launched because it is corrupt." UserInfo=0x7fe06a218720 {NSURL=file://localhost/APPLICATIONAPATH, NSLocalizedDescription=The application “APPANAME” could not be launched because it is corrupt., NSUnderlyingError=0x7fe06a218af0 "The operation couldn’t be completed. (OSStatus error -10827.)"}

Once you launch (and quit) application A manually, launching it from the sandboxed application B starts to work too.

Notes: There does not seem to be any reason for this. Imagine that the user installs a suite of applications that need to launch each other, or an application that uses a helper application. Additionally the error codes do not make sense (-10827==kLSNoExecutableErr).

Comments

Looks similar to my 10866101, which was just marked as Duplicate/8868067.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com 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!