NSFileHandle returns the wrong error code on iOS 11

Originator:green
Number:rdar://36834515 Date Originated:January 24 2018
Status:Open Resolved:
Product:iOS + SDK (Foundation) Product Version:iOS 11
Classification:Other Reproducible:Always
 
Summary:
`-[NSFileHandle fileHandleWritingToURL:error:]` returns the error code `EINTR` (Interrupted system call) when the URL points to a local file that does not exist instead of the old `ENOENT`(No such file or directory). The error code changed on iOS 11.0 as compared with iOS 10.3 (possibly as far back as iOS 4). The same bug manifests itself between MacOS Sierra running HFS+ and MacOS High Sierra running APFS.

Steps to Reproduce:
Call fileHandleWritingToURL:error: with a non-existent file path and inspect the resulting error code.

Expected Results:
The error code should be `ENOENT`.

Actual Results:
The error code is `EINTR`.

Version/Build:
iOS 11.0, iOS 11.1, iOS 11.2, MacOS High Sierra

Configuration:
iPhone 6, Macbook Pro 2017

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!