misc/184340: PATH_MAX not interoperable with Linux

David Cundiff dcundiff at a2hosting.com
Wed Nov 27 23:10:01 UTC 2013

>Number:         184340
>Category:       misc
>Synopsis:       PATH_MAX not interoperable with Linux
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 27 23:10:00 UTC 2013
>Originator:     David Cundiff
>Release:        9.2-RELEASE
FreeBSD rsync6.a2hosting.com 9.2-STABLE FreeBSD 9.2-STABLE #0: Thu Oct 31 22:09:39 UTC 2013     root at snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
PATH_MAX in is not interoperable with Linux when transferring files with Rsync. Since file paths can be much longer on Linux(4096 bytes) Rsync will crash as it sets up a buffer based on PATH_MAX. Also as unicode use increases a PATH_MAX of 1024 would limit paths to 256 32-bit unicode characters. Using 4096 bytes unicode paths could be 1024 characters.

Sure Rsync could change the value in their source, however, there could be other programs that are used between FreeBSD and Linux that use the value and will have trouble.
This is defined in the kernel headers

/usr/src/sys/sys/syslimits.h:#define     PATH_MAX                 1024   /* max bytes in pathname */
Copy a file from a Linux machine to a FreeBSD machine where the pathname is greater than 1024 characters.
Change PATH_MAX in kernel to 4096 from 1024. Should be harmless and will fix the issue in any program that uses PATH_MAX from the kernel headers. Also would allow longer 32-bit unicode paths.


More information about the freebsd-bugs mailing list