mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
Merged revisions 81663 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81663 | lars.gustaebel | 2010-06-03 11:56:22 +0200 (Thu, 03 Jun 2010) | 4 lines Issue #8833: tarfile created hard link entries with a size field != 0 by mistake. The associated testcase did not expose this bug because it was broken too. ........
This commit is contained in:
parent
850fc85e69
commit
2470ff19e6
3 changed files with 9 additions and 2 deletions
|
@ -1920,7 +1920,7 @@ class TarFile(object):
|
||||||
tarinfo.mode = stmd
|
tarinfo.mode = stmd
|
||||||
tarinfo.uid = statres.st_uid
|
tarinfo.uid = statres.st_uid
|
||||||
tarinfo.gid = statres.st_gid
|
tarinfo.gid = statres.st_gid
|
||||||
if stat.S_ISREG(stmd):
|
if type == REGTYPE:
|
||||||
tarinfo.size = statres.st_size
|
tarinfo.size = statres.st_size
|
||||||
else:
|
else:
|
||||||
tarinfo.size = 0
|
tarinfo.size = 0
|
||||||
|
|
|
@ -661,10 +661,14 @@ class WriteTest(WriteTestBase):
|
||||||
if hasattr(os, "link"):
|
if hasattr(os, "link"):
|
||||||
link = os.path.join(TEMPDIR, "link")
|
link = os.path.join(TEMPDIR, "link")
|
||||||
target = os.path.join(TEMPDIR, "link_target")
|
target = os.path.join(TEMPDIR, "link_target")
|
||||||
open(target, "wb").close()
|
fobj = open(target, "wb")
|
||||||
|
fobj.write(b"aaa")
|
||||||
|
fobj.close()
|
||||||
os.link(target, link)
|
os.link(target, link)
|
||||||
try:
|
try:
|
||||||
tar = tarfile.open(tmpname, self.mode)
|
tar = tarfile.open(tmpname, self.mode)
|
||||||
|
# Record the link target in the inodes list.
|
||||||
|
tar.gettarinfo(target)
|
||||||
tarinfo = tar.gettarinfo(link)
|
tarinfo = tar.gettarinfo(link)
|
||||||
self.assertEqual(tarinfo.size, 0)
|
self.assertEqual(tarinfo.size, 0)
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -398,6 +398,9 @@ C-API
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #8833: tarfile created hard link entries with a size field != 0 by
|
||||||
|
mistake.
|
||||||
|
|
||||||
- Charset.body_encode now correctly handles base64 encoding by encoding
|
- Charset.body_encode now correctly handles base64 encoding by encoding
|
||||||
with the output_charset before calling base64mime.encode. Passes the
|
with the output_charset before calling base64mime.encode. Passes the
|
||||||
tests from 2.x issue 1368247.
|
tests from 2.x issue 1368247.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue