]> granicus.if.org Git - python/commitdiff
Merge with 3.2: Issue #13158: Fix decoding and encoding of base-256 number fields...
authorLars Gustäbel <lars@gustaebel.de>
Fri, 14 Oct 2011 10:53:10 +0000 (12:53 +0200)
committerLars Gustäbel <lars@gustaebel.de>
Fri, 14 Oct 2011 10:53:10 +0000 (12:53 +0200)
The nti() function that converts a number field from a tar header to a number
failed to decode GNU tar specific base-256 fields. I also added support for
decoding and encoding negative base-256 number fields.

1  2 
Lib/tarfile.py
Lib/test/test_tarfile.py
Misc/NEWS

diff --cc Lib/tarfile.py
Simple merge
Simple merge
diff --cc Misc/NEWS
index 65f862d33d78db1894e340f4d491268e3edf270f,77bc91f6b8f053dcbdbe1d498d46f1874f148ed1..b35a6be1fbe02806873c452d4d65be0226ac113e
+++ b/Misc/NEWS
@@@ -305,298 -235,219 +305,301 @@@ Core and Builtin
  Library
  -------
  
 -- Issue #11513: Fix exception handling ``tarfile.TarFile.gzopen()`` when
 -  the file cannot be opened.
++- Issue #13158: Fix decoding and encoding of GNU tar specific base-256 number
++  fields in tarfile.
 -- Issue #12687: Fix a possible buffering bug when unpickling text mode
 -  (protocol 0, mostly) pickles.
 +- Issue #13025: mimetypes is now reading MIME types using the UTF-8 encoding,
 +  instead of the locale encoding.
  
 -- Issue #10087: Fix the html output format of the calendar module.
 +- Issue #10653: On Windows, use strftime() instead of wcsftime() because
 +  wcsftime() doesn't format time zone correctly.
  
 -- Issue #12540: Prevent zombie IDLE processes on Windows due to changes
 -  in os.kill().
 +- Issue #13150: The tokenize module doesn't compile large regular expressions
 +  at startup anymore.
  
 -- Issue #12683: urlparse updated to include svn as schemes that uses relative
 -  paths. (svn from 1.5 onwards support relative path).
 +- Issue #11171: Fix distutils.sysconfig.get_makefile_filename when Python was
 +  configured with different prefix and exec-prefix.
  
 -- Issues #11104, #8688: Fix the behavior of distutils' sdist command with
 -  manually-maintained MANIFEST files.
 +- Issue #11254: Teach distutils and packaging to compile .pyc and .pyo files in
 +  PEP 3147-compliant __pycache__ directories.
  
 -- Issue #12464: tempfile.TemporaryDirectory.cleanup() should not follow
 -  symlinks: fix it. Patch by Petri Lehtinen.
 +- Issue #7367: Fix pkgutil.walk_paths to skip directories whose
 +  contents cannot be read.
  
 -- Issue #8887: "pydoc somebuiltin.somemethod" (or help('somebuiltin.somemethod')
 -  in Python code) now finds the doc of the method.
 +- Issue #3163: The struct module gets new format characters 'n' and 'N'
 +  supporting C integer types ``ssize_t`` and ``size_t``, respectively.
  
 -- Issue #12603: Fix pydoc.synopsis() on files with non-negative st_mtime.
 +- Issue #13099: Fix sqlite3.Cursor.lastrowid under a Turkish locale.
 +  Reported and diagnosed by Thomas Kluyver.
  
 -- Issue #12514: Use try/finally to assure the timeit module restores garbage
 -  collections when it is done.
 +- Issue #13087: BufferedReader.seek() now always raises UnsupportedOperation
 +  if the underlying raw stream is unseekable, even if the seek could be
 +  satisfied using the internal buffer.  Patch by John O'Connor.
  
 -- Issue #12607: In subprocess, fix issue where if stdin, stdout or stderr is
 -  given as a low fd, it gets overwritten.
 +- Issue #7689: Allow pickling of dynamically created classes when their
 +  metaclass is registered with copyreg.  Patch by Nicolas M. Thiéry and Craig
 +  Citro.
  
 -- Issue #12590: IDLE editor window now always displays the first line
 -  when opening a long file.  With Tk 8.5, the first line was hidden.
 +- Issue #4147: minidom's toprettyxml no longer adds whitespace to text nodes.
  
 -- Issue #12576: Fix urlopen behavior on sites which do not send (or obfuscates)
 -  Connection:close header.
 +- Issue #13034: When decoding some SSL certificates, the subjectAltName
 +  extension could be unreported.
  
 -- Issue #1813: Fix codec lookup under Turkish locales.
 +- Issue #9871: Prevent IDLE 3 crash when given byte stings
 +  with invalid hex escape sequences, like b'\x0'.
 +  (Original patch by Claudiu Popa.)
  
 -- Issue #12591: Improve support of "universal newlines" in the subprocess
 -  module: the piped streams can now be properly read from or written to.
 +- Issue #12306: Expose the runtime version of the zlib C library as a constant,
 +  ZLIB_RUNTIME_VERSION, in the zlib module. Patch by Torsten Landschoff.
  
 -- Issue #12591: Allow io.TextIOWrapper to work with raw IO objects (without
 -  a read1() method), and add an undocumented *write_through* parameter to
 -  mandate unbuffered writes.
 +- Issue #12959: Add collections.ChainMap to collections.__all__.
  
 -- Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows.
 +- Issue #8933: distutils' PKG-INFO files and packaging's METADATA files will
 +  now correctly report Metadata-Version: 1.1 instead of 1.0 if a Classifier or
 +  Download-URL field is present.
  
 -- Issue #10883: Fix socket leaks in urllib.request when using FTP.
 +- Issue #12567: Add curses.unget_wch() function. Push a character so the next
 +  get_wch() will return it.
  
 -- Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2
 -  directory, so that "import DLFCN" and other similar imports work on
 -  Linux 3.0.
 +- Issue #9561: distutils and packaging now writes egg-info files using UTF-8,
 +  instead of the locale encoding.
  
 -- Issue #7484: smtplib no longer puts <> around addresses in VRFY and EXPN
 -  commands; they aren't required and in fact postfix doesn't support that form.
 +- Issue #8286: The distutils command sdist will print a warning message instead
 +  of crashing when an invalid path is given in the manifest template.
  
 -- Close the call queue in concurrent.futures.ProcessPoolExecutor when
 -  shutdown() is called, without waiting for the garbage collector to kick in.
 +- Issue #12841: tarfile unnecessarily checked the existence of numerical user
 +  and group ids on extraction. If one of them did not exist the respective id
 +  of the current user (i.e. root) was used for the file and ownership
 +  information was lost.
  
 -- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
 +- Issue #12888: Fix a bug in HTMLParser.unescape that prevented it to escape
 +  more than 128 entities.  Patch by Peter Otten.
  
 -- Issue #4376: ctypes now supports nested structures with an endianness
 -  different than that of the parent structure.  Patch by Vlad Riscutia.
 +- Issue #12878: Expose a __dict__ attribute on io.IOBase and its subclasses.
  
 -- Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a
 -  TextIOWrapper to a huge value, not TypeError.
 +- Issue #12636: IDLE reads the coding cookie when executing a Python script.
  
 -- Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors
 -  if the process has only one pipe.
 +- Issue #12494: On error, call(), check_call(), check_output() and
 +  getstatusoutput() functions of the subprocess module now kill the process,
 +  read its status (to avoid zombis) and close pipes.
  
 -- Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support
 -  Python modules using a encoding different than UTF-8 (reading the coding
 -  cookie of the module).
 +- Issue #12720: Expose low-level Linux extended file attribute functions in os.
  
 -- Issue #12451: pydoc: importfile() now opens the Python module in binary mode,
 -  instead of text mode using the locale encoding, to avoid encoding issues.
 +- Issue #10946: The distutils commands bdist_dumb, bdist_wininst and bdist_msi
 +  now respect a --skip-build option given to bdist.  The packaging commands
 +  were fixed too.
  
 -- Issue #12451: runpy: run_path() now opens the Python module in binary mode,
 -  instead of text mode using the locale encoding, to support other encodings
 -  than UTF-8 (modules using the coding cookie).
 +- Issue #12847: Fix a crash with negative PUT and LONG_BINPUT arguments in
 +  the C pickle implementation.
  
 -- Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead
 -  of the text mode (using the locale encoding) to avoid encoding issues.
 +- Issue #11564: Avoid crashes when trying to pickle huge objects or containers
 +  (more than 2**31 items).  Instead, in most cases, an OverflowError is raised.
  
 -Extension Modules
 ------------------
 +- Issue #12287: Fix a stack corruption in ossaudiodev module when the FD is
 +  greater than FD_SETSIZE.
  
 -- Issue #12764: Fix a crash in ctypes when the name of a Structure field is not
 -  a string.
 +- Issue #12839: Fix crash in zlib module due to version mismatch.
 +  Fix by Richard M. Tew.
  
 -- Issue #11241: subclasses of ctypes.Array can now be subclassed.
 +- Issue #9923: The mailcap module now correctly uses the platform path
 +  separator for the MAILCAP environment variable on non-POSIX platforms.
  
 -- Issue #10309: Define _GNU_SOURCE so that mremap() gets the proper
 -  signature.  Without this, architectures where sizeof void* != sizeof int are
 -  broken.  Patch given by Hallvard B Furuseth.
 +- Issue #12835: Follow up to #6560 that unconditionally prevents use of the
 +  unencrypted sendmsg/recvmsg APIs on SSL wrapped sockets. Patch by David
 +  Watson.
 +
 +- Issue #12803: SSLContext.load_cert_chain() now accepts a password argument
 +  to be used if the private key is encrypted.  Patch by Adam Simpkins.
 +
 +- Issue #11657: Fix sending file descriptors over 255 over a multiprocessing
 +  Pipe.
 +
 +- Issue #12811: tabnanny.check() now promptly closes checked files. Patch by
 +  Anthony Briggs.
 +
 +- Issue #6560: The sendmsg/recvmsg API is now exposed by the socket module
 +  when provided by the underlying platform, supporting processing of
 +  ancillary data in pure Python code. Patch by David Watson and Heiko Wundram.
 +
 +- Issue #12326: On Linux, sys.platform doesn't contain the major version
 +  anymore. It is now always 'linux', instead of 'linux2' or 'linux3' depending
 +  on the Linux version used to build Python.
 +
 +- Issue #12213: Fix a buffering bug with interleaved reads and writes that
 +  could appear on BufferedRandom streams.
 +
 +- Issue #12778: Reduce memory consumption when JSON-encoding a large
 +  container of many small objects.
 +
 +- Issue #12650: Fix a race condition where a subprocess.Popen could leak
 +  resources (FD/zombie) when killed at the wrong time.
 +
 +- Issue #12744: Fix inefficient representation of integers between 2**31 and
 +  2**63 on systems with a 64-bit C "long".
 +
 +- Issue #12646: Add an 'eof' attribute to zlib.Decompress, to make it easier to
 +  detect truncated input streams.
 +
 +- Issue #11513: Fix exception handling ``tarfile.TarFile.gzopen()`` when
 +  the file cannot be opened.
 +
 +- Issue #12687: Fix a possible buffering bug when unpickling text mode
 +  (protocol 0, mostly) pickles.
 +
 +- Issue #10087: Fix the html output format of the calendar module.
 +
 +- Issue #12540: Prevent zombie IDLE processes on Windows due to changes
 +  in os.kill().
 +
 +- Add support for unary plus and unary minus to collections.Counter().
 +
 +- Issue #12683: urlparse updated to include svn as schemes that uses relative
 +  paths. (svn from 1.5 onwards support relative path).
 +
 +- Issue #12655: Expose functions from sched.h in the os module: sched_yield(),
 +  sched_setscheduler(), sched_getscheduler(), sched_setparam(),
 +  sched_get_min_priority(), sched_get_max_priority(), sched_rr_get_interval(),
 +  sched_getaffinity(), sched_setaffinity().
 +
 +- Add ThreadError to threading.__all__.
 +
 +- Issues #11104, #8688: Fix the behavior of distutils' sdist command with
 +  manually-maintained MANIFEST files.
 +
 +- Issue #11281: smtplib.STMP gets source_address parameter, which adds the
 +  ability to bind to specific source address on a machine with multiple
 +  interfaces. Patch by Paulo Scardine.
 +
 +- Issue #12464: tempfile.TemporaryDirectory.cleanup() should not follow
 +  symlinks: fix it. Patch by Petri Lehtinen.
 +
 +- Issue #8887: "pydoc somebuiltin.somemethod" (or help('somebuiltin.somemethod')
 +  in Python code) now finds the doc of the method.
  
 -C-API
 ------
 +- Issue #10968: Remove indirection in threading.  The public names (Thread,
 +  Condition, etc.) used to be factory functions returning instances of hidden
 +  classes (_Thread, _Condition, etc.), because (if Guido recalls correctly) this
 +  code pre-dates the ability to subclass extension types.  It is now possible to
 +  inherit from Thread and other classes, without having to import the private
 +  underscored names like multiprocessing did.
  
 -Build
 ------
 +- Issue #9723: Add shlex.quote functions, to escape filenames and command
 +  lines.
  
 -- Issue #12560: Build libpython.so on OpenBSD.  Patch by Stefan Sperling.
 +- Issue #12603: Fix pydoc.synopsis() on files with non-negative st_mtime.
  
 -- Issue #12592: Make Python build on OpenBSD 5 (and future major releases).
 +- Issue #12514: Use try/finally to assure the timeit module restores garbage
 +  collections when it is done.
  
 -- Issue #12372: POSIX semaphores are broken on AIX: don't use them.
 +- Issue #12607: In subprocess, fix issue where if stdin, stdout or stderr is
 +  given as a low fd, it gets overwritten.
  
 -Tools/Demos
 ------------
 +- Issue #12590: IDLE editor window now always displays the first line
 +  when opening a long file.  With Tk 8.5, the first line was hidden.
  
 -- Issue #10639: reindent.py no longer converts newlines and will raise
 -  an error if attempting to convert a file with mixed newlines.
 +- Issue #12576: Fix urlopen behavior on sites which do not send (or obfuscates)
 +  Connection:close header.
  
 -Tests
 ------
 +- Issue #12102: Document that buffered files must be flushed before being used
 +  with mmap. Patch by Steffen Daode Nurpmeso.
  
 -- Issue #12331: The test suite for lib2to3 can now run from an installed
 -  Python.
 +- Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling.
  
 -- Issue #12626: In regrtest, allow to filter tests using a glob filter
 -  with the ``-m`` (or ``--match``) option.  This works with all test cases
 -  using the unittest module.  This is useful with long test suites
 -  such as test_io or test_subprocess.
 +- Issue #1813: Fix codec lookup under Turkish locales.
  
 -- Issue #12624: It is now possible to fail after the first failure when
 -  running in verbose mode (``-v`` or ``-W``), by using the ``--failfast``
 -  (or ``-G``) option to regrtest.  This is useful with long test suites
 -  such as test_io or test_subprocess.
 +- Issue #12591: Improve support of "universal newlines" in the subprocess
 +  module: the piped streams can now be properly read from or written to.
  
 -- Issue #12587: Correct faulty test file and reference in test_tokenize.
 -  (Patch by Robert Xiao)
 +- Issue #12591: Allow io.TextIOWrapper to work with raw IO objects (without
 +  a read1() method), and add a *write_through* parameter to mandate
 +  unbuffered writes.
  
 -- Try harder to reap dangling threads in test.support.reap_threads().
 +- Issue #10883: Fix socket leaks in urllib.request when using FTP.
  
 -- Issue #12573: Add resource checks for dangling Thread and Process objects.
 +- Issue #12592: Make Python build on OpenBSD 5 (and future major releases).
  
 -- Issue #12549: Correct test_platform to not fail when OS X returns 'x86_64'
 -  as the processor type on some Mac systems.
 +- Issue #12372: POSIX semaphores are broken on AIX: don't use them.
  
 -- Avoid failing in test_robotparser when mueblesmoraleda.com is flaky and
 -  an overzealous DNS service (e.g. OpenDNS) redirects to a placeholder
 -  Web site.
 +- Issue #12551: Provide a get_channel_binding() method on SSL sockets so as
 +  to get channel binding data for the current SSL session (only the
 +  "tls-unique" channel binding is implemented).  This allows the implementation
 +  of certain authentication mechanisms such as SCRAM-SHA-1-PLUS.  Patch by
 +  Jacek Konieczny.
  
 -- Issue #12440: When testing whether some bits in SSLContext.options can be
 -  reset, check the version of the OpenSSL headers Python was compiled against,
 -  rather than the runtime version of the OpenSSL library.
 +- Issue #665194: email.utils now has format_datetime and parsedate_to_datetime
 +  functions, allowing for round tripping of RFC2822 format dates.
  
 -- Issue #12497: Install test/data to prevent failures of the various codecmaps
 -  tests.
 +- Issue #12571: Add a plat-linux3 directory mirroring the plat-linux2
 +  directory, so that "import DLFCN" and other similar imports work on
 +  Linux 3.0.
  
 -- Issue #12496: Install test/capath directory to prevent test_connect_capath
 -  testcase failure in test_ssl.
 +- Issue #7484: smtplib no longer puts <> around addresses in VRFY and EXPN
 +  commands; they aren't required and in fact postfix doesn't support that form.
  
 -- Issue #12469: Run "wakeup" signal tests in subprocess to run the test in a
 -  fresh process with only one thread and to not change signal handling of the
 -  parent process.
 +- Issue #12273: Remove ast.__version__. AST changes can be accounted for by
 +  checking sys.version_info or sys._mercurial.
  
 -- Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run
 -  test_tk or test_ttk_guionly under a username that is not currently logged
 -  in to the console windowserver (as may be the case under buildbot or ssh).
 +- Silence spurious "broken pipe" tracebacks when shutting down a
 +  ProcessPoolExecutor.
 +
 +- Fix potential resource leaks in concurrent.futures.ProcessPoolExecutor
 +  by joining all queues and processes when shutdown() is called.
  
 +- Issue #11603: Fix a crash when __str__ is rebound as __repr__.  Patch by
 +  Andreas Stührk.
  
 -What's New in Python 3.2.1?
 -===========================
 +- Issue #11321: Fix a crash with multiple imports of the _pickle module when
 +  embedding Python.  Patch by Andreas Stührk.
  
 -*Release date: 10-Jul-2011*
 +- Issue #6755: Add get_wch() method to curses.window class. Patch by Iñigo
 +  Serna.
  
 -Library
 --------
 +- Add cgi.closelog() function to close the log file.
  
 -- Issue #12467: warnings: fix a race condition if a warning is emitted at
 -  shutdown, if globals()['__file__'] is None.
 +- Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
  
 -Tests
 ------
 +- Issue #4376: ctypes now supports nested structures in a endian different than
 +  the parent structure. Patch by Vlad Riscutia.
  
 -- Skip network tests when getaddrinfo() returns EAI_AGAIN, meaning a temporary
 -  failure in name resolution.
 +- Raise ValueError when attempting to set the _CHUNK_SIZE attribute of a
 +  TextIOWrapper to a huge value, not TypeError.
  
 -- Avoid failing in test_urllibnet.test_bad_address when some overzealous
 -  DNS service (e.g. OpenDNS) resolves a non-existent domain name.  The test
 -  is now skipped instead.
 +- Issue #12504: Close file handles in a timely manner in packaging.database.
 +  This fixes a bug with the remove (uninstall) feature on Windows.
  
 +- Issues #12169 and #10510: Factor out code used by various packaging commands
 +  to make HTTP POST requests, and make sure it uses CRLF.
  
 -What's New in Python 3.2.1 release candidate 2?
 -===============================================
 +- Issue #12016: Multibyte CJK decoders now resynchronize faster. They only
 +  ignore the first byte of an invalid byte sequence. For example,
 +  b'\xff\n'.decode('gb2312', 'replace') gives '\ufffd\n' instead of '\ufffd'.
  
 -*Release date: 03-Jul-2011*
 +- Issue #12459: time.sleep() now raises a ValueError if the sleep length is
 +  negative, instead of an infinite sleep on Windows or raising an IOError on
 +  Linux for example, to have the same behaviour on all platforms.
  
 -Core and Builtins
 ------------------
 +- Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support
 +  Python scripts using a encoding different than UTF-8 (read the coding cookie
 +  of the script).
  
 -- Issue #12291: You can now load multiple marshalled objects from a stream, with
 -  other data interleaved between marshalled objects.
 +- Issue #12493: subprocess: Popen.communicate() now also handles EINTR errors
 +  if the process has only one pipe.
  
 -- Issue #12084: os.stat on Windows now works properly with relative symbolic
 -  links when called from any directory.
 +- Issue #12467: warnings: fix a race condition if a warning is emitted at
 +  shutdown, if globals()['__file__'] is None.
  
 -- Issue #1195: my_fgets() now always clears errors before calling fgets(). Fix
 -  the following case: sys.stdin.read() stopped with CTRL+d (end of file),
 -  raw_input() interrupted by CTRL+c.
 +- Issue #12451: pydoc: importfile() now opens the Python script in binary mode,
 +  instead of text mode using the locale encoding, to avoid encoding issues.
  
 -- Issue #9670: Increase the default stack size for secondary threads on Mac OS X
 -  and FreeBSD to reduce the chances of a crash instead of a "maximum recursion
 -  depth" RuntimeError exception (patch by Ronald Oussoren).
 +- Issue #12451: runpy: run_path() now opens the Python script in binary mode,
 +  instead of text mode using the locale encoding, to support other encodings
 +  than UTF-8 (scripts using the coding cookie).
  
 -Library
 --------
 +- Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead
 +  of the text mode (using the locale encoding) to avoid encoding issues.
  
  - Issue #12147: Adjust the new-in-3.2 smtplib.send_message method for better
 -  conformance to the RFCs: correctly handle Sender and Resent headers.
 +  conformance to the RFCs:  correctly handle Sender and Resent- headers.
  
  - Issue #12352: Fix a deadlock in multiprocessing.Heap when a block is freed by
    the garbage collector while the Heap lock is held.