Adrian Muscalu wrote:
Hello,
I am running an ANT script on my Win XP machine; one of the tasks attempts to create a jar file where the class files are in a directory with a long name. The combined path, package name and file name exceedes 255 characters. Expected result:
The script should fail as the files exceed the Windows XP file system 
limitation.
Actual result:
The build finishes with a successfull state although the files that have the 
long name in the soturce directory have not been included into the jar.
I was hoping for ANT to report on the problem and stop the build; Ant managed to create the long named files just fine, but any subsequent operation on them (copy, jar) fails without notification. Any attempt to work with the files on the Windows DOS prompt (copy command) ends with a pertinent message saying that the file name is too long and the operation fails. Is this a bug? I don't expect ANT to fix the XP limitation, just to report on it somehow.

This is interesting. The first thing to consider is what is MAX_PATH, the limit on file length. Because the answer isnt 255, or even 260, its 32768 -but only under the unicode API, and you have to use funny \\?\ filename prefixes

http://msdn.microsoft.com/en-us/library/aa365247.aspx

Assuming the Sun JVM uses this API to talk to the OS -and it is an assumption- then Ant should be able to work with long filenames. But if some of the API doesnt, we're in trouble.

Looking at the state of things, not all of java is consistent, even on java6
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4403166
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6481955

But, some of the API does work with long files, as you've noticed.

1. I dont think its an ant bug so much as a JVM issue. We just open and close files, and take whatever API we're given.
2. That doesnt mean it isnt inconvenient

The fix is for the Java API to go to full length filenames everywhere, even if it gives you the right to create filenames that old apps cant handle.

--
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to