[Bug 6504] New: regression in url parsing on python 3.9

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Sun Mar 28 20:54:13 UTC 2021


https://bz.mercurial-scm.org/show_bug.cgi?id=6504

            Bug ID: 6504
           Summary: regression in url parsing on python 3.9
           Product: Mercurial
           Version: stable branch
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: hgweb
          Assignee: bugzilla at mercurial-scm.org
          Reporter: pierre-yves.david at ens-lyon.org
                CC: mercurial-devel at mercurial-scm.org
    Python Version: ---

Starting with Python 3.9, mercurial is no longer able to parse hgweb call using
';' as parameter separator.

This is the fault of a behavior change of the `urllib.parse.parse_qsl`
function:

Changed in version 3.9.2: Added separator parameter with the default value of
&. Python versions earlier than Python 3.9.2 allowed using both ; and & as
query parameter separator. This has been changed to allow only a single
separator key, with & as the default separator.

They are no obvious way to restore the previous behavior…

This result in the following test failure.

--- /home/marmoute/src/mercurial-dev/tests/test-archive.t
+++ /home/marmoute/src/mercurial-dev/tests/test-archive.t.err
@@ -350,49 +350,59 @@
   >     sys.stderr.write(str(e) + '\n')
   > EOF
   $ "$PYTHON" getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
-  test-archive-1701ef1f1510/.hg_archival.txt
-  test-archive-1701ef1f1510/.hgsub
-  test-archive-1701ef1f1510/.hgsubstate
-  test-archive-1701ef1f1510/bar
-  test-archive-1701ef1f1510/baz/bletch
-  test-archive-1701ef1f1510/foo
-  test-archive-1701ef1f1510/subrepo/sub
+  HTTP Error 400: no such method: archive;node=1701ef1f1510;type=gz
+  
+  gzip: stdin: unexpected end of file
+  [2]
   $ "$PYTHON" getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
-  test-archive-1701ef1f1510/.hg_archival.txt
-  test-archive-1701ef1f1510/.hgsub
-  test-archive-1701ef1f1510/.hgsubstate
-  test-archive-1701ef1f1510/bar
-  test-archive-1701ef1f1510/baz/bletch
-  test-archive-1701ef1f1510/foo
-  test-archive-1701ef1f1510/subrepo/sub
+  HTTP Error 400: no such method: archive;node=1701ef1f1510;type=bz2
+  
+  bunzip2: Compressed file ends unexpectedly;
+       perhaps it is corrupted?  *Possible* reason follows.
+  bunzip2: Inappropriate ioctl for device
+       Input file = (stdin), output file = (stdout)
+  
+  It is possible that the compressed file(s) have become corrupted.
+  You can use the -tvv option to test integrity of such files.
+  
+  You can use the `bzip2recover' program to attempt to recover
+  data from undamaged sections of corrupted files.
+  
+  [2]
   $ "$PYTHON" getarchive.py "$TIP" zip > archive.zip
+  HTTP Error 400: no such method: archive;node=1701ef1f1510;type=zip
   $ unzip -t archive.zip
   Archive:  archive.zip
-      testing: test-archive-1701ef1f1510/.hg_archival.txt*OK (glob)
-      testing: test-archive-1701ef1f1510/.hgsub*OK (glob)
-      testing: test-archive-1701ef1f1510/.hgsubstate*OK (glob)
-      testing: test-archive-1701ef1f1510/bar*OK (glob)
-      testing: test-archive-1701ef1f1510/baz/bletch*OK (glob)
-      testing: test-archive-1701ef1f1510/foo*OK (glob)
-      testing: test-archive-1701ef1f1510/subrepo/sub*OK (glob)
-  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

   $ "$PYTHON" getarchive.py "$TIP" gz baz | gunzip | tar tf - 2>/dev/null
-  test-archive-1701ef1f1510/baz/bletch
+  HTTP Error 400: no such method: archive;node=1701ef1f1510;type=gz;file=baz
+  
+  gzip: stdin: unexpected end of file
+  [2]
   $ "$PYTHON" getarchive.py "$TIP" gz foo | gunzip | tar tf - 2>/dev/null
-  test-archive-1701ef1f1510/foo
+  HTTP Error 400: no such method: archive;node=1701ef1f1510;type=gz;file=foo
+  
+  gzip: stdin: unexpected end of file
+  [2]

 test that we detect file patterns that match no files

   $ "$PYTHON" getarchive.py "$TIP" gz foobar
-  HTTP Error 404: file(s) not found: foobar
+  HTTP Error 400: no such method:
archive;node=1701ef1f1510;type=gz;file=foobar

 test that we reject unsafe patterns

   $ "$PYTHON" getarchive.py "$TIP" gz relre:baz
-  HTTP Error 404: file(s) not found: relre:baz
+  HTTP Error 400: no such method:
archive;node=1701ef1f1510;type=gz;file=relre:baz

   $ killdaemons.py


ERROR: test-archive.t output changed
!
Failed test-archive.t: output changed

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list