searchfs on APFS returns symlinks when asking for file sizes only

Originator:tempelmann
Number:rdar://34459322 Date Originated:2017-09-15
Status:Open Resolved:
Product:macOS Product Version:10.13
Classification:Other Bug Reproducible:Always
 
Summary:
When trying to search for files matching a range of file sizes, searchfs() should only return matching files. However, on APFS, it returns seemingly every symlink as well, even if their symlink data does not match the size range.

Steps to Reproduce:
Attached is the Xcode project for a "searchfs" tool along with an executable.

Run the tool on 10.13 with an APFS volume like this, replacing lowsize and highsize with numbers such as 2 and 2:

  ./searchfs -v -s lowsize -S highsize /

This would list all files whose data length is between lowsize and highsize on that volume.

Expected Results:
Should only list files that match the given size range.

Actual Results:
Lists many 1000 items alongside. It seems to be EVERY symlink existing on the volume.

Note 2: The same search, when performed on an HFS+ volume, correctly lists only the files, not the folders.

Version/Build:
10.13 beta 9 (17A360a)

Comments


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!