MacOS – Files Greyed out in Finder – Potential extended attributes issue

extended-attributesfindermacos

I am having a rather strange issue with some image files I have on a local file server. I have spent a while trying to figure it out, to no avail. Hopefully someone on here can offer some assistance.

Recently, after I import image files from my camera, they appear greyed out in my finder window, and I cannot open them or copy them. Terminal sees them just fine, and I can operate on them without issue. If I copy the files to a new directory after clearing the xattrs, they work just fine. This is somewhat of a pain, and does take time for large amounts of files, so I'd like to avoid this if possible. I have seem some people suggest that the xattrs are at fault with similar issues, so I first checked that out. There are indeed extended attributes on the affected files, notably com.apple.FinderInfo. If I either delete com.apple.FinderInfo, or completely remove xattrs with:
xattr -c *
the files are no longer greyed out and are accessible again.

The crux of the issue is that after some time (about 15 secs or so), Finder regenerates the com.apple.FinderInfo xattr, and the files are greyed out and inaccessible again.

Some potentially helpful notes I've compiled:

  • Before being greyed out, the date modified shows correctly as Today
  • After being greyed out, the date modified (in Finder) shows as
    January 24, 1984
  • Interestingly, even after being greyed out, the date modified from
    a GetFileInfo command shows correctly as Today, even though it shows at 1984 in Finder
  • Performing a touch on the greyed out file doesn't change the incorrect Date Modified in the Finder window
  • Performing mdls on either the parent folder or the greyed out file shows one interesting field: kMDItemFSCreationDate = 1970-01-01 00:00:00 +0000
  • If I copy the affected folder from within Terminal while the files are greyed out, the problem persists in the new folder; If I copy the folder after deleting the xattrs without giving com.apple.FinderInfo a chance to regenerate, the new files don't seem to have com.apple.FinderInfo regenerate, and are able to be opened and copied just fine
  • For some reason, I can't seem to update permissions on the affected files. After a sudo chmod a+rwx * I still get this permissions string from ls: -rwx------@
  • The files are stored on a smb share from a local networked server running ZFS on FreeNAS 9.2.1.8; I believe I first encountered this issue sometime after updating the FreeNAS version, but I can't be sure whether or not that caused it, as I'm sure other software on my computer changed during that period as well.
  • At some point in the past I changed some Finder preferences to disable .DS_Store creation on network shares, as there is no .DS_Store file generated in these directories

Any help on this issue would be much appreciated, as it's starting to drive me a little crazy. Thanks in advance!

Best Answer

This worked, but after external disk (NTFS) eject the problem was back

xattr -d com.apple.FinderInfo fileToUpdate 

(or for all files in a folder xattr -d com.apple.FinderInfo *)

This worked after eject/re-mount

xattr -wx com.apple.FinderInfo 

0000000000000000001000000000000000000000000000000000000000000000 fileToUpdate

Notes from man xattr:

 xattr -w [-rsx] attr_name attr_value file ...
 xattr -x  Force the attribute value to be displayed in the hexadecimal representation.