• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Translating filenames for command line?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Translating filenames for command line?


  • Subject: Re: Translating filenames for command line?
  • From: Charles Srstka <email@hidden>
  • Date: Tue, 1 Jan 2002 15:47:35 -0600

On Tuesday, January 1, 2002, at 07:37 AM, Thomas Lachand-Robert wrote:

Le mardi 1 janvier 2002, ` 02:21 , Scott Anguish a icrit :
That was just a bog-standard badly written shell script, nothing to do with system().

system("rm -rf /Volumes/Harddisk 1/Applications/iTunes.app");

yeah, right.


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...


  • Follow-Ups:
    • Re: Translating filenames for command line?
      • From: Scott Anguish <email@hidden>
References: 
 >Re: Translating filenames for command line? (From: Thomas Lachand-Robert <email@hidden>)

  • Prev by Date: Re: Multiple Inheritance
  • Next by Date: Re: OOP Clarification: difference between classes and instances, compare with C++
  • Previous by thread: Re: Translating filenames for command line?
  • Next by thread: Re: Translating filenames for command line?
  • Index(es):
    • Date
    • Thread