-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when trying to retrieve attributes on an external volume #118
Comments
I have been able to read the attributes of the file on the external volume (com.apple.FinderInfo and com.apple.metadata:_kMDItemUserTags) using xattr. Both command line, and in python. Perhaps they don't use MDItemCreate internally, which is where osxmetatag is failing. I haven't entirely worked out the format of the colour attributes, but I have managed a horrible hack which will filter the files according to colour tags, which is what I was trying to achieve. So for the moment I don't need to use osxmetadata. A bit weird and frustrating though. |
Could this be a sandboxing issue affecting osxmetatag and not xattr? I'm not sure how that stuff works. |
I have been able to replicate this on Ventura. I do not have a machine running Sequoia. This is weird because previously on Ventura I was able to use OSXMetadata fine. (I pulled a command from my zsh history I'd previously used). OSXMetadata uses a private Apple API for most operations unlike xattr which uses a public OS level API. It is possible Apple has changed the private API or somehow restricted the private API to a private entitlement. If so, it is weird they'd do this for external drives and not internal. (I've seen them start doing this in Sequoia with other private APIs, in particular Photos, which I also use extensively in other projects). I will look into this as time permits to see if I can figure it out as OSXMetadata is an important part of my workflow. If you merely want to read the extended attributes then direct access to them via xattr works fine, in most cases, and earlier versions of OSXMetadata did this. However, in many cases, writing to the extended attributes does not update the actual metadata in the Spotlight database. These are managed by the private API. Hence, OSXPhotos was rewritten to use the MDItemCreate API. The code that is failing is in the call to MDItemCreate and this is a public API. The documentation does not indicate anything has changed. The only private API access is used when writing attributes. The function may have been changed to require paths to external volumes in a different format. I will see if I can figure out what is going on. |
The code appears to work on mounted disk images and on mounted SMB shares. It only fails on directly attached external volumes which is very strange. |
So this appears to affect the native MacOS utility ❯ ls /Volumes/OWC_Backup/Photos/rhet/2024/10/14/IMG_0457_20241014.HEIC
/Volumes/OWC_Backup/Photos/rhet/2024/10/14/IMG_0457_20241014.HEIC
❯ mdls /Volumes/OWC_Backup/Photos/rhet/2024/10/14/IMG_0457_20241014.HEIC
/Volumes/OWC_Backup/Photos/rhet/2024/10/14/IMG_0457_20241014.HEIC: could not find /Volumes/OWC_Backup/Photos/rhet/2024/10/14/IMG_0457_20241014.HEIC. |
Apologies if this has been covered before, but I couldn't see any mention of it. I have just installed osxmetadata and I am experimenting with it, but I have hit a problem straight away.
I have files on an external volume which I am trying to read the attributes for. However, it crashes when creating MDItem for the file:
If I copy the same file onto the main hard disk (using finder), then it works fine:
Obviously I can't copy every file from the external disk, there isn't the space. Is there something I am not doing right? Is it a known problem?
It's Python 3.10.14 on Sequoia 15.1.1 and python does have access to external volumes. The filesystem is APFS (Case-sensitive, Encrypted).
I can provide any further information that I may have missed, just let me know. Thanks!
The text was updated successfully, but these errors were encountered: