Resource Fork updates are being issued with a wrong path in 10.14 Mojave

Originator:jchien
Number:rdar://44324967 Date Originated:9/10/2018
Status:Resolved Resolved:macOS 10.14.4 beta 3 (18E194d)
Product:macOS Product Version:10.14 18A384a
Classification: Reproducible:100%
 
Summary: 
In 10.14 18A384a (Beta 10), after a move, writes to a resource fork are being issued with file events at the old path instead of the new path.

I've attached minimal code repros. WatchTmpForever.m is the Objective-C source that starts a FileEvents on /tmp and prints out info it receives. WatchTmpForever is the compiled binary. fileops.py creates a file, writes a resource fork, moves it, updated the resource fork again, and then deletes the file. 


Steps to Reproduce:
1. Create a file (`srcfork.txt` in the example).
2. Write a resource fork to it.
3. Move the file (moved to `dstfork.txt` in the example)
4. Write to the new file's resource fork.

To run the example, start `WatchTmpForever` in a Terminal window, and run `fileops.py` in another Terminal window to observe the discrepancy.
output_comparison.log is a comparison of the outputs on 10.13 and 10.14. The wrong event is #5 in the log. 

Expected Results:
File events (event #5 in the example) issued on the destination path being written to. 
Here is the correct event output on 10.13.6 with APFS when writing to the resource fork at the new location
```
2018-09-10 17:30:09.485 WatchTmpForever[3307:49601640] Event 5: Item modified: /private/tmp/forkdst.txt
2018-09-10 17:30:09.485 WatchTmpForever[3307:49601640] Event 5: Item renamed: /private/tmp/forkdst.txt
2018-09-10 17:30:09.485 WatchTmpForever[3307:49601640] Event 5: XAttr changed: /private/tmp/forkdst.txt
```

Actual Results:
File events on the old path being written to.
Here is the wrong event output on 10.14 18A384a with APFS when writing to the resource fork at the new location
```
2018-09-10 17:24:20.822 WatchTmpForever[499:9526] Event 5: Item created: /private/tmp/forksrc.txt
2018-09-10 17:24:20.822 WatchTmpForever[499:9526] Event 5: Item modified: /private/tmp/forksrc.txt
2018-09-10 17:24:20.822 WatchTmpForever[499:9526] Event 5: Item renamed: /private/tmp/forksrc.txt
2018-09-10 17:24:20.822 WatchTmpForever[499:9526] Event 5: XAttr changed: /private/tmp/forksrc.txt
```

Version/Build:
10.14 18A384a (Beta 10) with APFS

Configuration:
Tested on 10.13.6 with APFS and HFS+ (did not repro), and tested on 10.14 18A384a (Beta 10) with APFS (100% repro).

Comments

This is fixed as of macOS 10.14.4 beta 3 (18E194d)


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!