C.A.M. Gerlach <cam.gerl...@gerlach.cam> added the comment:

I opened a PR to implement both those changes, and also added some minor 
related clarifications and fixes to the format section of the tarfile docs.

> how tarfile.Tarfile behaves if you tell it to open a PAX_FORMAT archive using 
> GNU_FORMAT or vice-versa

I tested tarfile.Tarfile() and extract_all() on the resulting object with 
several different simple- to moderately-complex (including Unicode filenames) 
real-world pax- and GNU-format archives packed with different archivers, with 
both format=GNU_FORMAT and format=PAX_FORMAT for each one, got no warnings or 
errors with debug=3 and errorlevel=2, and extraction was successful and yielded 
identical results for either format argument, and did not get a PAXHEADERS file 
output for either one. Furthermore, tracing the code, its not clear that 
Tarfile() (with 'r') and extract, etc. use the passed `format`.

Even if so, in order to produce an error after this change but not before, all 
of the following would seem to have to be the case:

* The tarfile being read would have to be in GNU format, i.e. from an external 
source or produced with an older version of Python
* The tarfile would have to make use of specific extended/non-standard GNU tar 
features not tested above
* The user would have to use Tarfile() to open the tarfile, rather than one of 
the other, more common/higher-level methods
* The user's call to Tarfile() would have to have used DEFAULT_FORMAT rather 
than being explicitly specified. and implicitly relied DEFAULT_FORMAT == 
GNU_FORMAT

Therefore, this seems like a very specific corner-case. However, if you think I 
should include it, I'll go ahead with it. Also, let me know if these doc 
changes should have a separate NEWS entry or the previous one adequately covers 
it.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue30661>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to