Environment
- macOS Version: 26.1
- Xcode Version: 16.2
Description
I'm developing a custom file system using FSKit and have encountered an issue where the removeItem(_:named:fromDirectory:) method in my FSVolume.Operations implementation is not being invoked when attempting to delete files or directories through Finder or the command line.
Implementation
My volume implements the required FSVolume.Operations protocol with the following removeItem implementation:
func removeItem(
_ item: FSItem,
named name: FSFileName,
fromDirectory directory: FSItem
) async throws {
logger.info("remove: \(name)")
if let item = item as? MyFSItem, let directory = directory as? MyFSItem {
directory.removeItem(item)
} else {
throw fs_errorForPOSIXError(POSIXError.EIO.rawValue)
}
}
Steps to Reproduce
-
Mount the custom FSKit-based file system using: mount -F -t MyFS /dev/diskX /tmp/mountpoint
-
Create files using Finder or terminal (works correctly -
createItemis called) -
Attempt to delete a file using any of the following methods:
- Terminal command:
rm -rf /path/to/mounted/file - option + cmd + delete to remove the file in Finder
- Terminal command:
Expected Behavior
The removeItem(_:named:fromDirectory:) method should be called, logging "remove: [filename]" and removing the item from the directory's children collection.
Actual Behavior
The removeItem method is never invoked. No logs appear from this method in Console.app. The deletion operation either fails silently or returns an error, but the callback never occurs.
Additional Context
- Working operations: Other operations work correctly including:
createItem- files and directories can be createdlookupItem- items can be looked up successfullyenumerateDirectory- directory listing worksreadandwrite- file I/O operations work correctly
- Volume state:
- The volume is properly mounted and accessible
- Files can be created, read, and written successfully
- Volume capabilities configured:
var supportedVolumeCapabilities: FSVolume.SupportedCapabilities {
let capabilities = FSVolume.SupportedCapabilities()
capabilities.supportsHardLinks = true
capabilities.supportsSymbolicLinks = true
capabilities.supportsPersistentObjectIDs = true
capabilities.doesNotSupportVolumeSizes = true
capabilities.supportsHiddenFiles = true
capabilities.supports64BitObjectIDs = true
capabilities.caseFormat = .insensitiveCasePreserving
return capabilities
}
Questions
- Are there specific volume capabilities or entitlements required for
removeItemto be invoked? - Is there a specific way deletion operations need to be enabled in FSKit?
- Could this be related to how file permissions or attributes are set during
createItem? - Are there any known issues with deletion operations in the current FSKit implementation?
- Do I need to implement additional protocols or set specific flags to support item deletion?
Any guidance would be greatly appreciated. Has anyone successfully implemented deletion operations in FSKit?
Thank you!