How can I prevent my application from setting the quarantine bit?

Starting with OS X 10.7.3, my text editor sets the quarantine bit in any file that it affects.

My text editor is designed to work with shell scripts, and if the quarantine bit is set, the shell script cannot be executed from the command line until you double-click it in Finder and go through "This application has been downloaded from the Internet" (or delete the quarantine bit using xattr).

For example, I just created a "hello world" script in my application, it was quarantined and cannot be executed:

$ xattr -l foo
com.apple.quarantine: 0006;4f51dd2f;Dux;
$ chmod +x foo
$ ./foo
-bash: ./foo: Operation not permitted

If I delete the quarantine bit, the script works:

$ xattr -d com.apple.quarantine foo
$ ./foo
hello world


, TextEdit script, .

NSDocument :

- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
{
  return [self.textStorage.string dataUsingEncoding:self.stringEncoding];
}


, ? , TextWrangler, .

UPDATE

, script, : perl- html.

, . , .

Radar, , , /, .

+5
3

, ​​ OS X 10.8 (Mountain Lion).

, 10.8 . ... , , Apple 10.7 ( 10.8 , 10.7, , ).

0

, LSFileQuarantineEnabled Info.plist false ( ). , removexattr(2)/fremovexattr(2)

+1

, , . , , ( , XML...).

, LSFileQuarantineEnabled .

, , removexattr http://hints.macworld.com/article.php?story=20071029151619619, - .

: http://reviews.cnet.com/8301-13727_7-57374676-263/workarounds-for-quarantine-bug-in-os-x-lion/

Apple.

EDIT: , .

The problem was that if the file data is simple XML data, MacOS displays the message erroneously (I think this is because it mistakenly assumes the file is a script). If I change the file format as an alternative that is clearly not XML, the warning disappears. The file is still saved with the quarantine bit set!

So, this is definitely related to the problem on MacOS, but there is a relatively simple solution - just change the file format!

+1
source

All Articles