You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Marshall Schor <ms...@schor.com> on 2013/11/21 16:53:20 UTC
Early review of DUCC pre-release - use of PATH_MAX in c code in spawn
project
while looking at this, I didn't know what PATH_MAX was, so I googled it and found
http://www.gnu.org/software/libc/manual/html_mono/libc.html#Limits-for-Files
which says: ... is defined in limits.h only if the system has a fixed, uniform
limit for the parameter in question. If the system allows different file systems
or files to have different limits, then the macro is undefined; use pathconf or
fpathconf to find out the limit that applies to a particular file
This blog entry
http://stackoverflow.com/questions/9449241/where-is-path-max-defined-in-linux
has a link also to "flaws" in PATH_MAX that points to :
http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html which is an
entertaining read (the headline is "Insane Coding" / "PATH_MAX simply isn't"
-Marshall
Re: Early review of DUCC pre-release - use of PATH_MAX in c code in spawn project
Posted by Jim Challenger <ch...@gmail.com>.
The constant is simply a convenient way to declare a 'mostly big enough' buffer for a number of things, only one of which is the file path. There is a lot of checking and ducc_ling will fail if it thinks something is going to try to overlay the end of the buffer. I can change this to a hard constant that isn't PATH_MAX, such as 4096, and avoid the issue. When it's used for generating a path, if my hard-coded value allows too long a path, the operating system would just complain on the mkdir() and ducc_ling would exit with error, which is correct and expected behavior.
Jim
On Nov 21, 2013, at 10:53 AM, Marshall Schor <ms...@schor.com> wrote:
> while looking at this, I didn't know what PATH_MAX was, so I googled it and found
>
> http://www.gnu.org/software/libc/manual/html_mono/libc.html#Limits-for-Files
>
> which says: ... is defined in limits.h only if the system has a fixed, uniform
> limit for the parameter in question. If the system allows different file systems
> or files to have different limits, then the macro is undefined; use pathconf or
> fpathconf to find out the limit that applies to a particular file
>
> This blog entry
> http://stackoverflow.com/questions/9449241/where-is-path-max-defined-in-linux
> has a link also to "flaws" in PATH_MAX that points to :
>
> http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html which is an
> entertaining read (the headline is "Insane Coding" / "PATH_MAX simply isn't"
>
> -Marshall