Bug 37 - absolute_file_name/3 does not handle long windows path names properly
: absolute_file_name/3 does not handle long windows path names properly
Status: CONFIRMED
Product: SWI-Prolog
Classification: Unclassified
Component: core
: unspecified
: PC Windows
: Highest normal
Assigned To: Jan Wielemaker
:
:
:
  Show dependency treegraph
 
Reported: 2012-05-31 20:06 CEST by Holger Kanwischer
Modified: 2012-06-01 14:57 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Kanwischer 2012-05-31 20:06:06 CEST
Hi Jan,

maybe it is possible to make SWI-Prolog long-path-name-ready in
(very) small chunks :-)

Cheers
Holger

Version 6.0.2, Windows XP, 32-Bit.

3 ?- absolute_file_name('\\\\?\\d:\\tmp\\x.tmp', [], Abs).
Abs = '/?/d:/tmp/x.tmp'.

It should be
Abs = '//?/d:/tmp/x.tmp'
Comment 1 Jan Wielemaker 2012-06-01 14:57:42 CEST
Hi Holger,

That is not entirely clear.  The idea behind absolute_file_name/2 is that it
produces a canonical name for a file.  Surely, the current answer is wrong,
but it could well be that the correct answer is d:/tmp/x.tmp.  The alternative
would be to map d:/tmp/x.tmp to //?/d:/tmp/x.tmp ...

At the moment, it is not really clear to me what the status of //?/ should be.
Its also not really clear to me what it really means.  From the docs, I
understand
that it stops mapping / to \.  That is irrelevant to us because SWI-Prolog maps
/ to \.  I guess it also does something with the old 8+3 name interface, but
this
is pretty much irrelevant in the Windows world as well nowadays.  

For short, can't we just strip "//?/"?  That doesn't fix the problem with long
pathnames, but some initial tests shows that size_file/2 stops at 260
characters,
regardless of whether one uses //?/ or not.  This seems to be a limitation of 
the MSVC runtime stat() function (we use _wstati64()), although I have not
found
a document that confirms this.

Otherwise, I guess the most sensible way is for you to establish a list of
issues
around the long name notation (//?/) and PATH_MAX (260 chars).

    Cheers --- Jan