Patchwork [Bug,4492] New: test-archive fails with recent Python 2.7

login
register
mail settings
Submitter mercurial-bugs@selenic.com
Date Jan. 6, 2015, 9:32 p.m.
Message ID <bug-4492-285@http.bz.selenic.com/>
Download mbox | patch
Permalink /patch/7339/
State Not Applicable
Headers show

Comments

mercurial-bugs@selenic.com - Jan. 6, 2015, 9:32 p.m.
http://bz.selenic.com/show_bug.cgi?id=4492

          Priority: normal
            Bug ID: 4492
                CC: mercurial-devel@selenic.com
          Assignee: bugzilla@selenic.com
           Summary: test-archive fails with recent Python 2.7
          Severity: bug
    Classification: Unclassified
                OS: All
          Reporter: Arfrever.FTA@GMail.Com
          Hardware: All
            Status: UNCONFIRMED
           Version: 3.2.4
         Component: Mercurial
           Product: Mercurial

test-archive fails with recent snapshot of Python 2.7 branch (since
https://hg.python.org/cpython/rev/c2c4cde55f6f).
I use Mercurial 3.2.4.


test-archive.t
test-archive.t ... # Test test-archive.t
# Running sh "/tmp/tests/child0/test-archive.t.sh"

+      write(name, 0644, False, metadata)
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 258, in write
+      archiver.addfile(prefix + name, mode, islink, data)
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 198, in addfile
+      self.z.writestr(i, data)
+    File "/usr/lib64/python2.7/zipfile.py", line 1246, in writestr
+      self.fp.seek(self.start_dir, 0)
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 147, in __getattr__
+      return getattr(self.fp, key)
+  AttributeError: 'wsgirequest' object has no attribute 'seek'
+  

   $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
   $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
@@ -106,16 +132,16 @@
   test-archive-1701ef1f1510/foo
   test-archive-1701ef1f1510/subrepo/sub
   $ python getarchive.py "$TIP" zip > archive.zip
+  HTTP Error 500: Internal Server Error
   $ unzip -t archive.zip
   Archive:  archive.zip
-      testing: test-archive-1701ef1f1510/.hg_archival.txt   OK
-      testing: test-archive-1701ef1f1510/.hgsub   OK
-      testing: test-archive-1701ef1f1510/.hgsubstate   OK
-      testing: test-archive-1701ef1f1510/bar   OK
-      testing: test-archive-1701ef1f1510/baz/bletch   OK
-      testing: test-archive-1701ef1f1510/foo   OK
-      testing: test-archive-1701ef1f1510/subrepo/sub   OK
-  No errors detected in compressed data of archive.zip.
+    End-of-central-directory signature not found.  Either this file is not
+    a zipfile, or it constitutes one disk of a multi-part archive.  In the
+    latter case the central directory and zipfile comment will be found on
+    the last disk(s) of this archive.
+  unzip:  cannot find zipfile directory in one of archive.zip or
+          archive.zip.zip, and cannot find archive.zip.ZIP, period.
+  [9]

 test that we can download single directories and files

@@ -303,6 +329,58 @@
 server errors

   $ cat errors.log
+  127.0.0.1 - - [06/Jan/2015 21:19:52] Exception happened during processing
request '/archive/tip.zip':
+  Traceback (most recent call last):
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/server.py", line
80, in do_POST
+      self.do_write()
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/server.py", line
73, in do_write
+      self.do_hgweb()
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/server.py", line
141, in do_hgweb
+      for chunk in self.server.application(env, self._start_response):
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgweb_mod.py",
line 142, in __call__
+      return self.run_wsgi(req)
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgweb_mod.py",
line 253, in run_wsgi
+      content = getattr(webcommands, cmd)(self, req, tmpl)
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/webcommands.py",
line 926, in archive
+      subrepos=web.configbool("web", "archivesubrepos"))
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 286, in archive
+      write(name, 0644, False, metadata)
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 258, in write
+      archiver.addfile(prefix + name, mode, islink, data)
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 198, in addfile
+      self.z.writestr(i, data)
+    File "/usr/lib64/python2.7/zipfile.py", line 1246, in writestr
+      self.fp.seek(self.start_dir, 0)
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 147, in __getattr__
+      return getattr(self.fp, key)
+  AttributeError: 'wsgirequest' object has no attribute 'seek'
+  
+  127.0.0.1 - - [06/Jan/2015 21:19:53] Exception happened during processing
request '/?cmd=archive;node=1701ef1f1510;type=zip':
+  Traceback (most recent call last):
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/server.py", line
80, in do_POST
+      self.do_write()
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/server.py", line
73, in do_write
+      self.do_hgweb()
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/server.py", line
141, in do_hgweb
+      for chunk in self.server.application(env, self._start_response):
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgweb_mod.py",
line 142, in __call__
+      return self.run_wsgi(req)
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgweb_mod.py",
line 253, in run_wsgi
+      content = getattr(webcommands, cmd)(self, req, tmpl)
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/webcommands.py",
line 926, in archive
+      subrepos=web.configbool("web", "archivesubrepos"))
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 286, in archive
+      write(name, 0644, False, metadata)
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 258, in write
+      archiver.addfile(prefix + name, mode, islink, data)
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 198, in addfile
+      self.z.writestr(i, data)
+    File "/usr/lib64/python2.7/zipfile.py", line 1246, in writestr
+      self.fp.seek(self.start_dir, 0)
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 147, in __getattr__
+      return getattr(self.fp, key)
+  AttributeError: 'wsgirequest' object has no attribute 'seek'
+  

 empty repo


ERROR: test-archive.t output changed
!# Ret was: 0

Patch

--- /tmp/mercurial-3.2.4/tests/test-archive.t
+++ /tmp/mercurial-3.2.4/tests/test-archive.t.err
@@ -52,10 +52,36 @@ 
   403 Archive type not allowed: gz
   $ test_archtype zip zip tar.gz tar.bz2
   % zip allowed should give 200
-  200 Script output follows
+  500 Internal Server Error
   % tar.gz and tar.bz2 disallowed should both give 403
   403 Archive type not allowed: gz
   403 Archive type not allowed: bz2
+  127.0.0.1 - - [06/Jan/2015 21:19:52] Exception happened during processing
request '/archive/tip.zip':
+  Traceback (most recent call last):
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/server.py", line
80, in do_POST
+      self.do_write()
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/server.py", line
73, in do_write
+      self.do_hgweb()
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/server.py", line
141, in do_hgweb
+      for chunk in self.server.application(env, self._start_response):
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgweb_mod.py",
line 142, in __call__
+      return self.run_wsgi(req)
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/hgweb_mod.py",
line 253, in run_wsgi
+      content = getattr(webcommands, cmd)(self, req, tmpl)
+    File
"/tmp/root/usr/lib64/python2.7/site-packages/mercurial/hgweb/webcommands.py",
line 926, in archive
+      subrepos=web.configbool("web", "archivesubrepos"))
+    File "/tmp/root/usr/lib64/python2.7/site-packages/mercurial/archival.py",
line 286, in archive