This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix allocation limit for getcwd syscall


Roland McGrath <roland@redhat.com> writes:

> We have bigger problems if PATH_MAX is defined but is not actually the
> limit on the path name length as POSIX specifies.  If there is a larger
> limit, that should be the PATH_MAX value.  If there is no limit, then
> PATH_MAX should not be defined.

PATH_MAX only limits the length you can pass to functions taking a file
name.  It does _not_ limit the length of absolute names of files in the
system.  The coreutils testsuite explicitly tests for the ability to
determine the name of the cwd when it exceeds PATH_MAX.

> That said, I don't think the code should presume what the kernel
> implementation does in this regard.  It should do something other than
> crash when it gets ERANGE.

PAGE_MAX has always been the limit that the kernel imposes on getcwd.  It
was wrong to use PATH_MAX in the first place.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]