develooper Front page | perl.perl5.porters | Postings from January 2012

Re: [perl #109262] Increase the fallback value of MAXPATHLEN

Thread Previous | Thread Next
Dominic Hargreaves
January 29, 2012 10:55
Re: [perl #109262] Increase the fallback value of MAXPATHLEN
Message ID:
On Sun, Jan 29, 2012 at 09:01:35AM -0800, Mark Overmeer via RT wrote:
> * Dominic Hargreaves ( [120129 15:20]:
> > > * Dominic Hargreaves ( [120128 23:09]:
> > > <>
> > On Sat, Jan 28, 2012 at 03:34:49PM -0800, Mark Overmeer via RT wrote:
> > > You like to enlarge the default for MAXPATHLEN to an other artificial
> > > value, where also a known PATH_MAX is probably too small.  So, why not
> > > remove the attempt to get a realistic value from the OS here?
> > >    #define ALWAYS_LARGE_ENOUGH  32768
> > >    Char *bufnext, *bufend, patbuf[ALWAYS_LARGE_ENOUGH];
> > >    bufend = bufnext + ALWAYS_LARGE_ENOUGH - 1;
> > 
> > As I understand it, you're suggesting picking a different arbitrary value
> > as a maximum, and using it even when the underlying system wouldn't 
> > support paths that long. I'm not convinced that this is an improvement
> > on my suggestion. Have I missed something?
> The document you pointed us to, and documents referred to in that doc,
> suggest that PATH_MAX/MAXPATHLEN are constants much shorter than
> the actual maximum size of the path.
> So, why should the buffer used
> in bsd_glob.c be smaller than may be needed?  In lack of any useful
> constant with a realistic value, we can just pick something huge (in
> this context)

Right, I see that you're referring to
which mentions how it's possible to create paths longer than PATH_MAX,
on systems which define PATH_MAX but which aren't Windows, but that doing
so risks not being able to manipulate the path with anything which uses
PATH_MAX. I'm not sure I want to be the one who enables that in perl,
even if it theoretically correct.

My choice of 4096 was a trade off based on what people seem to expect
(because of other systems' limits) without inflating the size of the
buffer unnecessarily.

In an ideal world, there wouldn't be a fixed size buffer here at all,
but in the absence, the minimal change I suggested still seems like the
right thing to do.

Dominic Hargreaves |
PGP key 5178E2A5 from (keyserver,web,email)

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About