Re: Translating filenames for command line?
Re: Translating filenames for command line?
- Subject: Re: Translating filenames for command line?
- From: Charles Srstka <email@hidden>
- Date: Tue, 1 Jan 2002 17:01:02 -0600
From looking at the binary, it appears that is exactly what it does, so
yes, in this case it would be possible to use NSTask to launch something
as root.
The reason they used that runner program is probably because (as I have
found out with Pacifist beta 3) if you use the Security framework to
launch tools too many times in rapid succession, it gets overloaded and
starts spitting out errors and not launching the tasks you want. So a
workaround is to use Security.framework to launch the runner, and then
use the runner to launch all your tasks.
I'm working on getting a similar approach to work with Pacifist, except
that my runner program doesn't currently launch tools as root, since
most of the stuff I needed root for was moving files, which
NSFileManager handles quite well inside the runner program.
On Tuesday, January 1, 2002, at 04:48 PM, Scott Anguish wrote:
In which case we can turn around and blame this on the
AuthenticationManager implementation of this, which seems to use the
CFTask stuff as I recall (could be wrong on that)
also, I wonder what role the 'runner' program in the Installation
framework plays in things.. perhaps it is executed via the
authentication stuff as root, and then it in turn calls things via
whatever (NSTask or something)
Layers, upon layers, upon layers.
On Tuesday, January 1, 2002, at 04:47 PM, Charles Srstka wrote:
It would have been the same problem if they'd called it via
NSTask (and that's more likely how that script was called...)
No that wouldn't. When using NSTask, you MUST separate yourself the
argument list:
[task setArguments:
[NSArray arrayWithObjects:@"-r", @"-f", @"/Volumes/Harddisk
1/Applications/iTunes.app", nil]];
is different than the system() call above, and doesn't have the same
bogus side effect.
So NSTask is a little bit longer to use, but is MUCH more secure.
Not to mention the fact that NSTask can't run things as root...