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.

classification
Title: test_zipfile fails under Windows
Type: behavior Stage:
Components: Tests Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pitrou Nosy List: barry, benjamin.peterson, ocean-city, pitrou
Priority: release blocker Keywords: patch

Created on 2009-04-04 17:17 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
no_drive.patch benjamin.peterson, 2009-05-02 15:57
issue5692.patch pitrou, 2009-05-02 20:21
Messages (9)
msg85414 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-04-04 17:17
Under Windows XP with VS 2008 Express:

test test_zipfile failed -- Traceback (most recent call last):
  File "Z:\py3k\__svn__\lib\test\test_zipfile.py", line 334, in testExtract
    self.assertEqual(writtenfile, correctfile)
AssertionError: 'c:_ziptest1' != 'c:\\_ziptest1'
msg85427 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-04-04 18:58
Let's worry about this after the alpha.
msg85430 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-04-04 20:08
This happens when running test from root directory. Following patch can
workaround this, but this code is there because it is needed, isn't it?
(Related to #4710?)

Index: Lib/zipfile.py
===================================================================
--- Lib/zipfile.py	(revision 71184)
+++ Lib/zipfile.py	(working copy)
@@ -957,11 +957,6 @@
         """Extract the ZipInfo object 'member' to a physical
            file on the path targetpath.
         """
-        # build the destination pathname, replacing
-        # forward slashes to platform specific separators.
-        if targetpath[-1:] in (os.path.sep, os.path.altsep):
-            targetpath = targetpath[:-1]
-
         # don't include leading "/" from file name if present
         if member.filename[0] == '/':
             targetpath = os.path.join(targetpath, member.filename[1:])


When targetpath is "C:/", targetpath becomes "C:" and os.path.join("C:",
"foo") returns "C:foo" instead of "C:/foo"
msg86208 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-04-20 21:59
You should probably just add a check that the path isn't in the root to
that condition.
msg86955 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-05-02 15:57
Can someone try this patch, please?
msg86974 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-02 19:49
I don't think your patch is specific enough. It should only trigger when
the targetpath is of the form "/" or "X:/".
By the way, while I first rated this bug release blocker, thinking
test_zipfile was failing for all Windows platforms, we can downgrade it
if it only happens in a root directory.
msg86977 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-02 20:21
This alternate patch is ok here (tested under Windows and Linux).
It's against trunk, since the bug actually exists there too.
msg87177 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-04 21:12
Benjamin oked the patch on IRC.
msg87181 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-05-04 21:25
Fixed in r72295, r72296, r72297.
History
Date User Action Args
2022-04-11 14:56:47adminsetnosy: + barry
github: 49942
2009-05-04 21:25:12pitrousetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg87181
2009-05-04 21:12:17pitrousetassignee: pitrou
resolution: accepted
messages: + msg87177
2009-05-02 20:21:26pitrousetversions: + Python 2.6, Python 3.0, Python 2.7
2009-05-02 20:21:16pitrousetfiles: + issue5692.patch

messages: + msg86977
2009-05-02 19:49:31pitrousetmessages: + msg86974
2009-05-02 15:57:33benjamin.petersonsetfiles: + no_drive.patch
keywords: + patch
messages: + msg86955
2009-04-20 21:59:54benjamin.petersonsetmessages: + msg86208
2009-04-04 23:34:58benjamin.petersonsetpriority: deferred blocker -> release blocker
2009-04-04 20:08:36ocean-citysetnosy: + ocean-city
messages: + msg85430
2009-04-04 18:58:46benjamin.petersonsetpriority: release blocker -> deferred blocker
nosy: + benjamin.peterson
messages: + msg85427

2009-04-04 17:17:12pitroucreate