ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41924] Untar target does not handle long filenames in POSIX tar files
Date Mon, 10 Aug 2009 18:18:19 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=41924



--- Comment #10 from Richard Gussmann <richard.gussmann@web.de> 2009-08-10 11:18:15
PDT ---
When you work on solaris 10 a posix compliant tar file would be created for
entries longer (or equal) 100 chars (solaris special). When you process such a
file with ant, the file will be extracted into the root which is definitely
wrong and the prefix part will be ignored. So I strongly recommend a fix to
deal with this issue.

To make sure this is done only with posix compliant tar archives you need to
check whether the ustar followed by a zero byte marker is present. Then also
the check supplied with the patch should be sufficient. 

A modified the TarEntry.java as follows

at the end of the function I added ... 

    public void parseTarHeader(byte[] header) {

        ... original code here 

        boolean ustarFormat = false;  
    //
    // NOTE Recognize archive header format.
    //
    if (  header[257] == 'u'
            && header[258] == 's'
            && header[259] == 't'
            && header[260] == 'a'
            && header[261] == 'r'
            && header[262] == 0 ) {
        ustarFormat = true;
    } /* if */

        if (ustarFormat && header[offset] != 0) {
            offset += DEVLEN;
            StringBuffer buf = new StringBuffer(156);
            buf = TarUtils.parseName(header, offset, 155);
            buf.append('/');
            buf.append(name);
            name = buf;           
        } /* if */

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message