In article <slrnju04uv....@krismbp.local>, Lewis
<g.k...@gmail.com.dontsendmecopies> wrote:
> > the maximum path length is 1024 characters and exceeding it can cause
> > unexpected results, including crashes.
>
> Cite?
look in /usr/include/sys/syslimits.h
% grep PATH_MAX /usr/include/sys/syslimits.h
#define PATH_MAX 1024 /* max bytes in pathname */
% grep NAME_MAX /usr/include/sys/syslimits.h
#define NAME_MAX 255 /* max bytes in a file name */
> There is no limit on path lengths in the HFS+ spec, there is a very old
> TN (from 2004) referenced on some sites, but no longer available at
> Apple, that stated:
>
> "The pathname stored in a symbolic link is assumed to be a POSIX
> pathname, as used by the Mac OS X BSD and Cocoa programming interfaces.
> It is not a traditional Mac OS, or Carbon, pathname. The path is encoded
> in UTF-8. It must be a valid UTF-8 sequence, with no null (zero) bytes.
> The path may refer to another volume. The path need not refer to any
> existing file or directory. The path may be full or partial (with or
> without a leading forward slash). For maximum compatibility, the length
> of the path should be 1024 bytes or less."
it's always helpful when people cite their own proof that they're
wrong. thanks!
> Note the use of *should*.
what about it? that doesn't mean it's unlimited or they would have said
it's unlimited. why cite a number at all?
the 1024 number is obviously PATH_MAX and exceeding it is going to
cause problems.
> Again, there is not maximum path length in HFS+
again, there very definitely is on os x.
> Here's a path well over 1024 characters.
>
> $ pwd
>
> /Users/lewis/1234567...
..snip..
now try to do something with a file or folder that has a path name that
long. it will not work properly and you may or may not get an error.
perform the following test:
in finder, create a folder with a *really* long name. duplicate it and
copy the duplicate into the original folder. open that folder and
repeat, nesting the folders. the closer you get to 255 characters per
folder, the fewer nestings you'll need.
at some point, when the total path length exceeds 1024 characters, the
copy will fail without warning (snow leopard) or generate an error
(lion). in older versions of os x, finder would just crash.
next, put a file with a short name into the deepest folder above
(before the copy fail) and try to rename it to something longer so that
the total path exceeds 1024 (but the file itself is <255). you'll get
an error that the name is too long.
that can only happen if there's a limit, which there is.