homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tlynn
Recipients lars.gustaebel, tlynn
Date 2012年09月05日.19:13:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346872414.86.0.579163691261.issue15858@psf.upfronthosting.co.za>
In-reply-to
Content
See attached bad.tar.
$ less bad.tar | cat
drwxr-xr-x 0/0 0 2012年09月05日 20:04 foo/
-rw-rw-r-- uname/gname 0 2012年09月05日 20:04 foo/a
$ python -c 'import tarfile; print(tarfile.open("bad.tar").getnames())'
['foo']
$ python -c 'import tarfile, patch; patch.patch_tarfile(); print (tarfile.open("bad.tar").getnames())'
['foo', 'foo/a']
I'm only allowed to attach one file via the tracker web UI, so patch.py will follow.
Creation code for bad.tar, largely for my benefit:
import java.io.FileOutputStream;
import java.io.IOException;
import org.codehaus.plexus.archiver.tar.TarOutputStream;
import org.codehaus.plexus.archiver.tar.TarEntry;
class TarTest {
 public static void main(String[] args) throws IOException {
 FileOutputStream fos = new FileOutputStream("bad.tar");
 TarOutputStream tos = new TarOutputStream(fos);
 TarEntry entry = new TarEntry("foo/");
 entry.setMode(16877); // 0o40755
 entry.setUserId(0);
 entry.setGroupId(0);
 entry.setUserName("");
 entry.setGroupName("");
 tos.putNextEntry(entry);
 TarEntry entry2 = new TarEntry("foo/a");
 entry2.setMode(33204); // 0o100664
 entry2.setUserId(-1); // XXX: dodgy
 entry2.setGroupId(-1); // XXX: dodgy
 entry2.setUserName("uname");
 entry2.setGroupName("gname");
 tos.putNextEntry(entry2);
 tos.close();
 fos.close();
 }
}
History
Date User Action Args
2012年09月05日 19:13:34tlynnsetrecipients: + tlynn, lars.gustaebel
2012年09月05日 19:13:34tlynnsetmessageid: <1346872414.86.0.579163691261.issue15858@psf.upfronthosting.co.za>
2012年09月05日 19:13:34tlynnlinkissue15858 messages
2012年09月05日 19:13:33tlynncreate

AltStyle によって変換されたページ (->オリジナル) /