On Mon, 21 Jul 2003 13:51:29 -0600, "Tobias Hoellrich"
<[EMAIL PROTECTED]> wrote:

>I trying to find a solution for a problem that involves "long" filenames
>under windows 2k/xp. This script:

[...]

>checking filename length of 251
>checking filename length of 252
>checking filename length of 253
>checking filename length of 254
>Copy failed - The filename, directory name, or volume label syntax is
>incorrect
>checking filename length of 255
>Copy failed - The system cannot find the path specified
>checking filename length of 256
>open for write - Invalid argument at \\santafe\c\tmp\perl\longfile\test.pl
>line 13.

That seems to be about correct to me.  The Win32 API defines MAX_PATH to
be 260 character, which includes the initial C:\ as well as the trailing
\0.  Some of the Unicode APIs support longer pathnames (up to 0x7fff
character, I believe).  Even when you use the Unicode APIs, you'll have to
prefix your filenames with \\?\, like \\?\C:\CONFIG.SYS.  For UNC names
you prefix with \\?\UNC\, like \\?\UNC\server\share\pathname.

The Perl internals use MAX_PATH dimensioned buffers in many places, so
even if you specify the -C option, you will be able to use longer
filenames:

Perl needs to virtualize all file system accesses for the fork() emulation
to have a "current working directory" on a per thread basis.  The code
that maps potentially relative filenames to absolute filenames uses a
MAX_PATH sized buffer, and all file accesses go through this code.  Moving
to Perl 5.8 won't help.

I've added an enhancement request for this:

    http://bugs.activestate.com/show_bug.cgi?id=26342

Note that the `perl -C` support in Perl is kind of broken though.  It was
added in Perl 5.005 days before Perl had internal support for UTF8
strings, and using the -C switch now misses up UTF8 handling in Perl 5.6
and Perl 5.8.  I would recommend against using it; it is kind of broken.
:(

Cheers,
-Jan

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to