Files wrongly considered as damaged in encfs volume

I am using encfs @1.7.5 and osxfuse @2.6.4 installed via MacPorts 2.2.1 on my MacBook Pro Retina Late 2013 which is running OS X Mavericks 10.9.2. When opening certain files (e.g. xlsx, pdf) in my encfs volume, I get an error "X is damaged and can't be opened." as well as a suggestion to move it to trash. However, when I copy that file elsewhere (i.e. not on the encfs volume), it appears to work just fine. Why is this?

EDIT: I looked online and found a post involving disabling GateKeeper. It did the trick. In essence, you go into "Security Preferences -> Security & Privacy -> Allow applications downloaded from: Anywhere".

I understand that the solution works, but I would like to know why it works. Thanks in advance.

EDIT 2: Also, if someone could tag my post with encfs, it'd be very appreciated.


Solution 1:

I've found the answer here (for BoxCryptor):

Under special circumstances, Mac OS X adds the extended attribute 'com.apple.quarantine' to a file which was e.g. downloaded from the internet. This can also happen to files within the BoxCryptor Folder. If an encrypted file has this extended attribute set, you receive the "is damaged" error message when trying to open the plaintext file in the BoxCryptor Volume.

Also try this, more secure workaround:

x) Open Terminal (Applications -> Utilities)

y) Run the following command (substitute the path):

$ xattr -r -d com.apple.quarantine /path/to/encfs/mount/point

Solution 2:

@apmouse is correct: you can repair the file with xattr. But you have to do that repeatedly – every time you save a file it will have the quarantine flag added back to it.

As you pointed out, there's a less safe but more convenient alternative: disable GateKeeper.

how to disable gatekeeper

I understand that the solution works, but I would like to know why it works. Thanks in advance.

The first thing to note is that if you go into Keynote and choose File → Open, you can open the "damaged" file without any issues. This implies that it is actually Finder that is intervening to prevent opening the file.

The error message "_____ is damaged and can't be opened" is actually a signature error (see here – about 3/4ths of the way down), meaning that GateKeeper can't verify a valid signature. Signature verification is supposed to be applied to executables, and I still haven't figured out why it's bugging out in this situation.

I tried compiling the osxfuse's sample loopback file system and putting the same "damaged" file on there and it opens just fine. So I think this bug is specific to encfs – not to osxfuse in general.

For what it's worth, there is a ticket open on the osxfuse project for this exact problem. If you're having this problem, post your details on that ticket.

Hope this helps...