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

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

Thread Previous | Thread Next
From:
Dominic Hargreaves
Date:
January 29, 2012 10:55
Subject:
Re: [perl #109262] Increase the fallback value of MAXPATHLEN
Message ID:
20120129185508.GK4209@urchin.earth.li
On Sun, Jan 29, 2012 at 09:01:35AM -0800, Mark Overmeer via RT wrote:
> * Dominic Hargreaves (dom@earth.li) [120129 15:20]:
> > > * Dominic Hargreaves (dom@earth.li) [120128 23:09]:
> > > <http://www.gnu.org/software/hurd/community/gsoc/project_ideas/maxpath.html>
> 
> > 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
<http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html>
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 | http://www.larted.org.uk/~dom/
PGP key 5178E2A5 from the.earth.li (keyserver,web,email)

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About