ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 15230] - TAR long path names (GNU format) append a trailing 0 char
Date Wed, 11 Dec 2002 02:38:23 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15230>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15230

TAR long path names (GNU format) append a trailing 0 char





------- Additional Comments From jdb@getsu.com  2002-12-11 02:38 -------
I've compared the output of ant's tar and GNU tar 1.13.19.  The write(0) and
length+1 in TarOutputStream are correct; the entry length includes a terminating
0 char.  So, the solution is to not include that 0 char in the name during input.

I suggest adding the following lines to the end of getNextEntry().  With this
patch, TarRoundTripTest passes.

--- src/main/org/apache/tools/tar/TarInputStream.orig	Wed Dec 11 04:45:39 2002
+++ src/main/org/apache/tools/tar/TarInputStream.java	Wed Dec 11 05:20:19 2002
@@ -275,6 +275,11 @@
                 longName.append(new String(buffer, 0, length));
             }
             getNextEntry();
+
+            // remove trailing null terminator
+            if( longName.length() > 0 && longName.charAt( longName.length() -
1
) == 0 ) {
+                longName.deleteCharAt( longName.length() - 1 );
+            }
             this.currEntry.setName(longName.toString());
         }

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message