Browse Source

Do not require tar files to be in ustar format. Old V7 format should now

be handled. The main difference is in the handling of uid vs uname which
isn't that relevant to Ant anyhow.

PR:	6634


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271510 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 23 years ago
parent
commit
1293c3bea0
1 changed files with 4 additions and 26 deletions
  1. +4
    -26
      src/main/org/apache/tools/tar/TarInputStream.java

+ 4
- 26
src/main/org/apache/tools/tar/TarInputStream.java View File

@@ -83,7 +83,8 @@ public class TarInputStream extends FilterInputStream {
protected byte[] readBuf;
protected TarBuffer buffer;
protected TarEntry currEntry;

private boolean v7Format;
public TarInputStream(InputStream is) {
this(is, TarBuffer.DEFAULT_BLKSIZE, TarBuffer.DEFAULT_RCDSIZE);
}
@@ -100,6 +101,7 @@ public class TarInputStream extends FilterInputStream {
this.oneBuf = new byte[1];
this.debug = false;
this.hasHitEOF = false;
this.v7Format = false;
}

/**
@@ -248,31 +250,7 @@ public class TarInputStream extends FilterInputStream {
if (!(headerBuf[257] == 'u' && headerBuf[258] == 's'
&& headerBuf[259] == 't' && headerBuf[260] == 'a'
&& headerBuf[261] == 'r')) {
this.entrySize = 0;
this.entryOffset = 0;
this.currEntry = null;

throw new IOException("bad header in block "
+ this.buffer.getCurrentBlockNum()
+ " record "
+ this.buffer.getCurrentRecordNum()
+ ", " +
"header magic is not 'ustar', but '"
+ headerBuf[257]
+ headerBuf[258]
+ headerBuf[259]
+ headerBuf[260]
+ headerBuf[261]
+ "', or (dec) "
+ ((int) headerBuf[257])
+ ", "
+ ((int) headerBuf[258])
+ ", "
+ ((int) headerBuf[259])
+ ", "
+ ((int) headerBuf[260])
+ ", "
+ ((int) headerBuf[261]));
this.v7Format = true;
}

if (this.debug) {


Loading…
Cancel
Save