Device-relative FSEventStream does not send root changed events

Number:rdar://8342264 Date Originated:23-Aug-2010 11:37 AM
Status:Duplicate/7737405 Resolved:26-Aug-2010
Product:Mac OS X Product Version:10.6.4
Classification:Other Bug Reproducible:Always
23-Aug-2010 11:37 AM Branton Homer:
When creating an FSEventStream with FSEventStreamCreateRelativeToDevice, passing the kFSEventStreamCreateFlagWatchRoot flag has no effect. Root changed events are never received.

Steps to Reproduce:
1. Create a FSEventStream using FSEventStreamCreateRelativeToDevice monitoring a directory on your system.
2. Delete (or move to the trash) the parent folder of the monitored directory.

Expected Results:
An event with the kFSEventStreamEventFlagRootChanged flag set.

Actual Results:
No such event is sent. As a result, if a user needs rootChanged events, they need to create a stream using FSEventStreamCreate. However, a stream created in that manner is not as useful when persisting event IDs, as mentioned in the documentation.


I have attached a sample application which clearly demonstrates the issue. In main.m, there are two #define'd variables at the top of the file. One of them controls whether the stream is created with FSEventStreamCreate or FSEventStreamCreateRelativeToDevice. The other controls the path to watch.

To use the test app, create a folder with a subdirectory. Set the PATH_TO_WATCH constant to be the path to the subdirectory. Start the application, then move the parent directory to the trash. If the stream was created with FSEventStreamCreate, the stream callback will be invoked with a rootChanged flag set. If not, the callback is never invoked.


Having the same issue

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!