com.apple.quarantine extended attribute gets set on opening a file with Marked 2

Greg Hurrell's Avatar

Greg Hurrell

15 Dec, 2015 09:44 AM

I wonder whether this is the result of sandboxing stuff that applies to the Mac App store version of this app, but I'm seeing the com.apple.quarantine extended attribute getting set on any file that I open with Marked 2.

Example, given "sample.md", ls -l@ sample.md shows the com.apple.quarantine attribute is present and xattr -p com.apple.quarantine sample.md shows it was creaded by Marked 2 (ie. it prints 0002;566fdc88;Marked 2;).

As a result, any attempt to open the file from the terminal with open -a Marked\ 2.app sample.md fails with the incredibly cryptic and misleading "The window server could not be contacted. open must be run with a user logged in at the console, either as that user or as root."

Workaround, remove the attribute with xattr -d com.apple.quarantine sample.md.

Alas, this doesn't appear to happen 100% of the time, and I haven't been able to discover the exact conditions necessary to make it happen. In my various experiments though, I've seen the attribute being set as a result of using open both inside and outside of tmux, and also as a result of using the "Open Recent" submenu in Marked 2 itself.

  1. Support Staff 1 Posted by Brett on 15 Dec, 2015 04:07 PM

    Brett's Avatar

    I am able to replicate this with the MAS version, and not the direct
    version, which lends credence to the idea that it's sandbox-related. I
    do not do anything unusual when reading a file, so I'll have to look
    into why this is happening.

    I do not, however, have any problem running `open -a Marked\ 2.app` on a
    file that gets the quarantine attribute set. If you run the command with
    the full path to Marked 2.app, do you still get that cryptic error?

    I'm willing to bet that apple will frown on anything that messes with
    that bit from within the app, so I'll need to figure out why it's
    happening in the first place.

  2. Support Staff 2 Posted by Brett on 15 Dec, 2015 04:10 PM

    Brett's Avatar

    What OS are you on? It looks like there was a related bug in OS X that
    started in Lion, but I assume it's been cleared up by now.

    -Brett

  3. Support Staff 3 Posted by Brett on 15 Dec, 2015 04:23 PM

    Brett's Avatar

    I figured it out already, there's an esoteric entitlement needed for the
    app, which I've added for the next update. Thanks for pointing this out.

    reference:
    http://stackoverflow.com/questions/9544874/how-can-i-stop-my-app-from-setting-the-quarantine-bit#comment36131063_11993894

    -Brett

  4. 4 Posted by Greg Hurrell on 15 Dec, 2015 05:19 PM

    Greg Hurrell's Avatar

    Excellent find! Thanks for digging into that.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac