Message134220
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. |
|
Date |
User |
Action |
Args |
2011-04-21 15:16:38 | mgold-qnx | set | recipients:
+ mgold-qnx, lars.gustaebel |
2011-04-21 15:16:37 | mgold-qnx | set | messageid: <1303398997.96.0.910828864.issue11899@psf.upfronthosting.co.za> |
2011-04-21 15:16:37 | mgold-qnx | link | issue11899 messages |
2011-04-21 15:16:37 | mgold-qnx | create | |
|