iOS File Name Byte Limit

Originator:rcpvirtucio
Number:rdar://26734276 Date Originated:2016/06/10
Status:Open Resolved:
Product:HFS+/Documentation Product Version:
Classification:Other Bug Reproducible:Always
 
# Title
iOS File Name Byte Limit

# Summary
I noticed that opening a PDF file (Open-in iBooks or any other app with PDF support) with more than 255 bytes of file name does not work. For example:

2pages_PortraitLandscapeあああああかかかかかさささささたたたたたなななななはははははまままままやややややらららららわわわわわいいいいいろろろろろはははははにににににほほほほほへへへへ.pdf (265 bytes)

When tapping "Open in iBooks"/"Open in..." in Safari, nothing happens. I found out that [iOS uses HFS+](http://apple.stackexchange.com/a/107887), which has [a limit of 255 UTF-16 characters](http://ntfs.com/hfs.htm). However, UTF-16 characters have a minimum of 2 bytes per character (and can be more). This means that the limit should not be based on bytes, but on the number of characters.

On a related note, renaming a file in OS X to the example above or anything similar shows an error that the file name is invalid. Since OS X also uses HFS, it is most likely the same.

My question is: are there actual documents/links that support the claim above (since I cannot seem to find any) or is this an unwritten rule in Apple file systems?

# Steps to Reproduce
1. In OS X, rename a file to:
2pages_PortraitLandscapeあああああかかかかかさささささたたたたたなななななはははははまままままやややややらららららわわわわわいいいいいろろろろろはははははにににににほほほほほへへへへ.pdf

2. In iOS (any version), open a PDF file in Safari or any app that loads PDFS with the file name, then tap on "Open in iBooks" or "Open in..":

2pages_PortraitLandscapeあああああかかかかかさささささたたたたたなななななはははははまままままやややややらららららわわわわわいいいいいろろろろろはははははにににににほほほほほへへへへ.pdf

# Expected Results
1. File should be renamed.

2. PDF file is opened in iBooks/other app.

# Actual Results
1. An error alert is displayed, saying that the file name is invalid.

2. Nothing happens.

# Documentation
OS X: Cross-platform filename best practices and conventions
https://support.apple.com/en-us/HT202808

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!