FSKit removeItem Not Being Called

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

  1. Mount the custom FSKit-based file system using: mount -F -t MyFS /dev/diskX /tmp/mountpoint

  2. Create files using Finder or terminal (works correctly - createItem is called)

  3. 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

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 created
    • lookupItem - items can be looked up successfully
    • enumerateDirectory - directory listing works
    • read and write - 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

  1. Are there specific volume capabilities or entitlements required for removeItem to be invoked?
  2. Is there a specific way deletion operations need to be enabled in FSKit?
  3. Could this be related to how file permissions or attributes are set during createItem?
  4. Are there any known issues with deletion operations in the current FSKit implementation?
  5. 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!

FSKit removeItem Not Being Called
 
 
Q