This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix readdir_r with long file names
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: KOSAKI Motohiro <kosaki dot motohiro at gmail dot com>, "Carlos O'Donell" <carlos at redhat dot com>, libc-alpha <libc-alpha at sourceware dot org>
- Date: Tue, 11 Jun 2013 10:42:45 -0700 (PDT)
- Subject: Re: [PATCH] Fix readdir_r with long file names
- References: <519220C7 dot 6050705 at redhat dot com> <20130516110136 dot GB11420 at spoyarek dot pnq dot redhat dot com> <5194CDEE dot 4020708 at redhat dot com> <20130516125029 dot GE11420 at spoyarek dot pnq dot redhat dot com> <5194D697 dot 8040106 at redhat dot com> <20130516130952 dot GA16952 at spoyarek dot pnq dot redhat dot com> <519B58EC dot 6060108 at redhat dot com> <51B0A2F9 dot 5060004 at redhat dot com> <51B0B39F dot 4060202 at redhat dot com> <51B0BD36 dot 3030202 at redhat dot com> <CAHGf_=r9Rz63pho+84ORk0a_oDyJSj-MCnZ56uPrT3L6sVEfeQ at mail dot gmail dot com> <51B0F1DD dot 5070901 at redhat dot com> <20130610223627 dot 0F6CC2C09F at topped-with-meat dot com> <51B6D6E1 dot 8080205 at redhat dot com>
> On 06/11/2013 12:36 AM, Roland McGrath wrote:
> >> There's precedent for my approach in realpath, where we don't use
> >> pathconf(path, _PC_PATH_MAX), either, but cap the path length at PATH_MAX.
> >
> > That's just following vanilla POSIX.1 rules: if PATH_MAX is defined at
> > compile time, it's a fixed system-wide limit. If PATH_MAX is not defined
> > at compile time, there might or might not be a limit and if there is a
> > limit it might be filesystem-specific; pathconf reports that.
>
> We must continue to define PATH_MAX and NAME_MAX for backwards
> compatibility reasons. This leads to ugly kludges when we're confronted
> with data from the kernel that exceeds the constants. (getwd is another
> such place.)
You cited the implementation details of canonicalize.c as an indication
that using PATH_MAX made some sort of intrinsic sense even if it might not
be the real limit. I was pointing out that there was no such rationale
involved in the use there. In fact, it was written that way to be right
for the GNU systems where PATH_MAX is not defined and there is no limit.