NSOutputStream cannot handle all relative URLs

Originator:mike.abdullah
Number:rdar://11206097 Date Originated:07-Apr-2012 01:48 PM
Status:Open Resolved:
Product:Mac OS X Product Version:10.6+
Classification: Reproducible:Always
 
07-Apr-2012 01:48 AM Mike Abdullah:
Summary:
NSOutputStream cannot handle URLs which consist of the form:
[NSURL URLWithString:@"/absolute/path" relativeToURL:[NSURL URLWithString:@"file://localhost/path/"]


Steps to Reproduce:
Create a stream using -[NSOutputStream initWithURL:append:] and attempt to write to it.
The following URLs should be tried:

1. [NSURL URLWithString:@"file://localhost/Users/Shared/test" relativeToURL:nil];
2. [NSURL URLWithString:@"test" relativeToURL:[NSURL URLWithString:@"file://localhost/Users/Shared/"]];
3. [NSURL URLWithString:@"/Users/Shared/test" relativeToURL:[NSURL URLWithString:@"file://localhost/Users/Shared/"]];


Expected Results:
All 3 of the above URL styles work


Actual Results:
1. and 2. work, but 3. fails, with the error code ENOENT

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!