I just discovered a new behavior that might be helpful. I'm storing my helper in MacOS (so that it can be located with [NSBundle pathForAuxiliaryExecutable:]). The call to openFile: causes both my application and helper to be executed. My application exits (or so launchd says, even if I put an NSLog in main(), nothing is printed), but my helper runs successfully.
This is still a mystery to me. Here's a roundup of situations (best viewed w/ fixed-width font): Expected behavior: My app runs normally. Wrong behavior: Launchd reports that my app exited with status 255, An NSLog before NSApplicationMain() is not called. A Foundation executable in my application's MacOS folder runs (passed argument -psn_0_...) (which should not happen). pre-touch/utime() behavior post-touch/utime() behavior -[NSWorkspace openFile:] from same process (euid 0): Wrong Wrong -[NSWorkspace openFile:] from new process (euid 0): Wrong Expected -[NSWorkspace openFile:] from new process (euid 50x): Expected Expected On Wed, Apr 22, 2009 at 3:04 PM, Sidney San Martín <s...@sidneysm.com> wrote: > I'm running into an issue that's above my skill level and could really > use some guidance. My application has an SUID-root update utility (I > know that's unusual, but it's an internal application that needs to be > able to update itself even when the logged-in user isn't privileged) > stored inside the application bundle. It downloads the update, sends a > message back to the parent application that it's OK to quit, moves the > new copy into place, and launches it. > > That last bit is giving me issues. I'm using -[NSWorkspace openFile:] > to do the actual relaunching. It returns YES, but my application > doesn't launch and "com.apple.launchd[152] > ([0x0-0xb80b8].com.mycompany.MyApplication[3836]) Exited with exit > code: 255" appears in the Console. > > I noticed that at this point, if I use open (on the command line) to > try to launch my (updated) application, it works. However, if I sudo > open, it prints "LSOpenFromURLSpec() failed with error -10810 for the > file ...". -10810 translates to "Unexpected internal error". > > If I touch the application bundle, open starts working as me and as > root. Following this thread, I tried calling utimes() from my helper > before openFile:, but run into the same condition. I've also tried > LSRegisterURL() with no change. Can anyone give me a hint as to what's > happening here? I'm lost. > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com