Spotlight metadata kMDItemLastUsedDate is not set when the com.apple.quarantine attribute is set

Originator:filettimarco
Number:rdar://23202426 Date Originated:21-Oct-2015
Status:Open Resolved:No
Product:OS X Product Version:10.11
Classification:2 - Important Reproducible:Yes
 
Summary:
kMDItemLastUsedDate is used to store when a document was last opened (I'm using this data for research purposes, but the problem arises also when searching using finder).

If an item is downloaded from the internet, OS X sets the flag "com.apple.quarantine"
to the downloaded file. This flag prevents the kMDItemLastUsedDate from being set appropriately. This prevents files downloaded from the internet from being shown as spotlight search results based on last opened dates.

Steps to Reproduce:
1. Download a file from the internet (call this "somefile.pdf")
2. Open the given file using Preview
3. In terminal type mdls somefile.pdf
4. The kMDItemLastUsedDate metadata item does not show as one of the available metadata items, even if the file was opened recently
5. In terminal, type xattr -d com.apple.quarantine somefile.pdf
6. Open the file using Preview
7. In terminal type mdls somefile.pdf
8. kMDItemLastUsedDate is now correctly shown

Expected Results:
kMDItemLastUsedDate should have appeared in step 4 above (immediately after opening file), but did not.

Actual Results:
kMDItemLastUsedDate only appears after the com.apple.quarantine is removed from the file using xattr, but not before.

Version:
10.11

Notes:


Configuration:
This seems to occur on every software and hardware configuration

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!