Re: NSTask and 10.9 [SOLVED]

2013-11-27 Thread koko

NSString *scriptPath = [[NSBundle mainBundle] pathForResource:@DeleteHidden 
ofType:nil];

NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath:scriptPath];

The script DeleteHidden had line endings of cf,lf which caused an exception 
on 10.9
removing the cr via a hex editor resolved the 10.9 issue

Thanks to all for the cycles.

-koko




On Nov 26, 2013, at 11:04 AM, Kyle Sluder k...@ksluder.com wrote:

 On Tue, Nov 26, 2013, at 09:37 AM, koko wrote:
 
 On Nov 26, 2013, at 10:26 AM, Kyle Sluder k...@ksluder.com wrote:
 
 Error 2 is ENOENT. The path you passed to -setLaunchPath: does not exist.
 
 
 
 Not possible as 
 
 [task setLaunchPath:rootScriptPath];
 
 where rootScriptPath is NSString *rootScriptPath = [[NSBundle mainBundle]
 pathForResource:@DeleteHiddenRoot ofType:nil];
 
 Well, you never actually proved that this method returns something other
 than nil. But we'll assume you verified that even passing a hardcoded,
 known-good path to -setLaunchPath: causes the same symptoms.
 
 
 so do you know if Mavericks disallows NSTask access to the App Bundle?
 
 
 Perhaps.
 
 Starting in Mavericks, all the binaries within a signed bundle must be
 themselves signed before the bundle is signed, because their signatures
 form part of the bundle's designated requirement. I've only seen this
 discussed in the context of frameworks, but I would not be surprised if
 it also applied to scripts or other tasks launched via posix_spawn.
 
 For more details, see Craig Hockenberry's blog post:
 http://furbo.org/2013/10/17/code-signing-and-mavericks/
 
 --Kyle Sluder
 

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSTask and 10.9 [SOLVED]

2013-11-27 Thread Kyle Sluder
 On Nov 27, 2013, at 7:59 AM, koko k...@highrolls.net wrote:

 
 NSString *scriptPath = [[NSBundle mainBundle] pathForResource:@DeleteHidden 
 ofType:nil];
 
 NSTask *task;
 task = [[NSTask alloc] init];
 [task setLaunchPath:scriptPath];
 
 The script DeleteHidden had line endings of cf,lf which caused an exception 
 on 10.9
 removing the cr via a hex editor resolved the 10.9 issue

Ha! Indeed, I can reproduce this on my machine using Terminal.app:
 
% cat foo
#!/bin/sh

echo Hello, world

% ./foo
zsh: ./foo: bad interpreter: /bin/sh^M: no such file or directory


So technically posix_spawn wasn't lying—when it parsed your shebang
line, it saw `#!/bin/shCR`, and couldn’t find a shell named `shCR`
to launch it.

--Kyle Sluder

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com