harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [jira] Created: (HARMONY-6238) [classlib][luni] File path limit set to 1K chars for all file systems
Date Thu, 18 Jun 2009 19:38:12 GMT
Oliver Deakin wrote:
> I've had a quick look around for the "right" way to do this, and it
> seems there are 2 options:
> 1) Determine the max path length from a system macro, probably PATH_MAX
> in limits.h.
> 2) Use the unix system call pathconf() to get the max path length.
> I think using a build time constant, as in 1, is preferable, however
> this macro is not defined on all platforms. On zOS, for example, only
> _POSIX_PATH_MAX is defined, and that is set to a paltry 256 (which is
> not the real max path length - pathconf() tells me it is 1024).
> Perhaps to start with we can include /usr/include/linux/limits.h and use
> PATH_MAX for linux platforms (I'm assuming that file exists for linux
> distros in general here - perhaps someone can clarify this?) and on
> non-linux platforms fall back to a default of 1024. We can add other
> platforms in as we find the correct includes/macro definitions for them.

>From the Harmony code I was looking at, the max path length is used to
allocate char buffers so we can do path manipulations before passing
through to OS calls.  We fail early if the path is greater than the
expected max path length.

Would could, as you say try to set the max path length based on the OS
we are using, but even that is going to be a guess since who knows where
the file path points (e.g. network drives etc.)?

I wonder if we can be a bit lazier and set the Harmony max path length
to a large number for the path manipulations, then let the OS call fail
if the path is too long?

(caveat: I've not looked at all uses of the HyMaxPath const to see if
that is a good idea or not)


View raw message