what does the spec say about file paths that are too long?
Alan Bateman
Alan.Bateman at oracle.com
Fri Aug 20 09:58:01 UTC 2021
On 19/08/2021 22:52, Alan Snyder wrote:
> I’ve been looking for some specification of what happens when a file request is made using a path that is too long (whatever that means to the underlying system).
> I have not found one.
> Is there one?
>
> My opinion is that silent truncation should not happen. Instead, an exception should be thrown.
>
> I have had the misfortunate of using an application (not Java) that did not check path lengths and the OS truncated the paths.
> The result was a kind of corruption to an implied schema causing incorrect search results and potentially data loss.
>
> Writing defensively to protect against silent path truncation is probably quite challenging, as well as tedious,
> especially when working with a system-independent API.
>
> If it is not already covered, I would like to see the specification mandate exceptions instead of silent truncation.
>
Where are you seeing "silent truncation"? You should see an I/O
exception if you attempt to access a file and the resolved file path is
too long.
-Alan
More information about the core-libs-dev
mailing list