Alexandre Duret-Lutz <[EMAIL PROTECTED]> wrote:

> >>> "Paul" == Paul Eggert <[EMAIL PROTECTED]> writes:
>
>  Paul> Alexandre Duret-Lutz <[EMAIL PROTECTED]> writes:
>
>  >> [EMAIL PROTECTED] selects the new pax format defined by POSIX
>  >> +1003.1-2001.  It supports filenames with up to 65535 characters.
>
>  Paul> Hmm, where did that "65535" come from?  I don't know of any limit of
>  Paul> 65535 bytes (presumably you meant bytes, not characters) that is
>  Paul> required by POSIX.
>
> I read that in the Heirloom pax manpage
>   http://heirloom.sourceforge.net/man/pax.1.html
>
> Maybe its maintainer can enlighten us.

The reason why I introduced this was the following: When cpio/pax
encounters a broken archive with a very large number in the file
name length field, it tries to allocate a lot of memory to store
the file name; it will eventually fail to allocate that memory
and terminate operation immediately. That's bad because if the
header was just skipped, another valid header could follow (with
-k/-K specified).

Thus I introduced some sane limit here. Since cpio does not
currently change its working directory, it is restriced to the
open() limit of PATH_MAX anyway and will get ENAMETOOLONG, which
is at 4096 on most systems. I chose 65535 because I've never seen
a Unix system which even remotely supports names of such length
for open(). But the value is arbitrary and could be raised to any
value as long as enough memory is available to store a file name.

        Gunnar

-- 
http://omnibus.ruf.uni-freiburg.de/~gritter


Reply via email to