Samuel Thibault
2008-Apr-04 14:17 UTC
[Xen-devel] Re: Use PATH_MAX for pathname char arrays.
Hello, Using PATH_MAX is not a good idea: POSIX says that that definition is facultative, in case the system does not impose any limit on path length. Some systems may also set PATH_MAX to a quite high value, and we would hence consume a lot of stack. Samuel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2008-Apr-04 14:30 UTC
Re: [Xen-devel] Re: Use PATH_MAX for pathname char arrays.
If there are better alternatives I''d be happy to use them instead. But we already use PATH_MAX elsewhere in the tools, so this might be a wider-ranging cleanup than you think. The original impetus for this change was due to bugchecks applied in some cases by glibc''s realpath() implementation. But actually is realpath() deprecated anyway? -- Keir On 4/4/08 15:17, "Samuel Thibault" <samuel.thibault@eu.citrix.com> wrote:> Hello, > > Using PATH_MAX is not a good idea: POSIX says that that definition > is facultative, in case the system does not impose any limit on path > length. Some systems may also set PATH_MAX to a quite high value, and > we would hence consume a lot of stack. > > Samuel > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Samuel Thibault
2008-Apr-04 14:51 UTC
Re: [Xen-devel] Re: Use PATH_MAX for pathname char arrays.
Keir Fraser, le Fri 04 Apr 2008 15:30:52 +0100, a écrit :> If there are better alternatives I''d be happy to use them instead. But we > already use PATH_MAX elsewhere in the tools, so this might be a > wider-ranging cleanup than you think.That''s possible indeed, I''m just making sure we try to avoid adding others :)> The original impetus for this change was due to bugchecks applied in > some cases by glibc''s realpath() implementation. > But actually is realpath() deprecated anyway?Ah, right, realpath has a bad semantic indeed. The intent of SUS is to have it allocate the string if NULL is given, but that''s not necessarily implemented yet. In the wild, I only know GNU/Hurd which doesn''t have any PATH_MAX limit, and it happens that that one has the allocation behavior. Samuel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Possibly Parallel Threads
- [PATCH 1/2] Implement realpath()
- [PATCH] R ignores PATH_MAX and fails in long directories (PR#14228)
- `PATH_MAX' undeclared here (not in a function) in asterisk!
- Patch for pigeonhole 0.4.0 avoiding PATH_MAX
- [PATCH klibc 0/3] Changes to support initramfs-tools 0.117