FSCatalogSearch and searchfs() on APFS do not ignore case in file names

Number:rdar://33455597 Date Originated:July 21 2017
Status:Dupe of 33454616 Resolved:Fixed in 10.13b7
Product:macOS Product Version:10.12.6 and 10.13b3
Classification:Serious Bug Reproducible:Always
This bug report affects both FSCatalogSearch and its low level searchfs functions when used with the APFS volume format.

The issue is that when the code compares file names with the search parameter, it does that case-sensitively, but it should be done case-_in_sensitively. On other volume formats, e.g. HFS+, this works as expected, so this is a APFS specific bug.

This issue is known by the dev team. I'm just filing this to add my vote for having this fixed before 10.13 goes final.

It may also affect searching with Spotlight, as it supposedly also invokes searchfs (I was frequently told this by several Apple engineers though I do not know the exact circumstances when this is the case), so this may not only be affecting 3rd party apps using this function, but a key component of macOS itself.

I consider this a "serious bug" because there is no work-around. Please don't forget to fix this. Many 100,000 of users of EasyFind and Find Any File rely on this working correctly when they convert their disks from HFS+ to APFS format.

Steps to Reproduce:
As said before, this is a known issue with the APFS file system team, so a verification should not be necessary.
Regardless, I've attached an Xcode project with a cmdline tool that invokes "searchfs" accordingly. I also included a sample APFS img for testing.

Mount the img, then open Terminal to run the included "searchfs" command like this:

./searchfs -v shot /Volumes/APFSi1

Expected Results:
Should list 57 files containing "shot" in their name.

Observed Results:
Finds no files. However, if you search for "Shot" instead of "shot", then the files are found.

On an HFS+ volume, the search would work no matter if you wrote "shot" or "Shot"


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!