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 mgold-qnx
Recipients lars.gustaebel, mgold-qnx
Date 2011-04-21.15:16:36
SpamBayes Score 4.7510207e-10
Marked as misclassified No
Message-id <1303398997.96.0.910828864.issue11899@psf.upfronthosting.co.za>
In-reply-to
Content
When I call tar.gettarinfo (where tar is a TarFile instance), the inode information is inserted into tar.inodes.  If I later call tar.gettarinfo on a linked file, the returned TarInfo will have type LNKTYPE.

I think it's incorrect to store this information in gettarinfo.  It should be done in addfile.

A comment in gettarinfo states "Is it a hardlink to an already archived file?".  But tar.inodes is modified in gettarinfo, and there's no reason to expect that the file will actually be archived, or will be archived with the same properties.  Bad links could result if the returned tarinfo object were modified before calling addfile.

I suggest changing the code as follows:
 - Create a static method (or non-member function) to fill in a given TarInfo object with stat/lstat/fstat results.  This would need a boolean "dereference" parameter.  (No TarFile instance should be required to create a TarInfo.)
 - Have tar.gettarinfo call the above function; then fill in tarinfo.tarfile, and modify tarinfo.type to LNKNAME if applicable.  Don't modify self.inodes.
 - In tar.addfile, call fstat, and store the inode info into self.inodes.
History
Date User Action Args
2011-04-21 15:16:38mgold-qnxsetrecipients: + mgold-qnx, lars.gustaebel
2011-04-21 15:16:37mgold-qnxsetmessageid: <1303398997.96.0.910828864.issue11899@psf.upfronthosting.co.za>
2011-04-21 15:16:37mgold-qnxlinkissue11899 messages
2011-04-21 15:16:37mgold-qnxcreate