Skip to content
Snippets Groups Projects
  1. Jun 08, 2022
  2. Jun 04, 2022
    • Manuel Jacob's avatar
      url: raise error if CONNECT request to proxy was unsuccessful · 51b07ac1991c
      Manuel Jacob authored
      The deleted code didn’t work on Python 3. On Python 2 (or Python 3 after
      adapting it), the function returned in the error case. The subsequent creation
      of SSL socket fails during handshake with a nonsense error.
      
      Instead, the user should get an error of what went wrong.
      
      I don’t see how the deleted code would be useful in the error case. The new
      code is also closer of what the standard library is doing nowadays that it has
      proxy support (which we don’t use in the moment).
      
      In the test, I use port 0 because all the HGPORTs were already taken. In
      practice, there should not be any server listening on port 0.
      51b07ac1991c
  3. Jun 03, 2022
  4. Jun 02, 2022
    • Manuel Jacob's avatar
      chg: replace mercurial.util.recvfds() by simpler pure Python implementation · c6a3243567b6
      Manuel Jacob authored
      On Python 3, we have socket.socket.recvmsg(). This makes it possible to receive
      FDs in pure Python code. The new code behaves like the previous
      implementations, except that it’s more strict about the format of the ancillary
      data. This works because we know in which format the FDs are passed.
      
      Because the code is (and always has been) specific to chg (payload is 1 byte,
      number of passed FDs is limited) and we now have only one implementation and
      the code is very short, I decided to stop exposing a function in
      mercurial.util.
      
      Note on terminology: The SCM_RIGHTS mechanism is used to share open file
      descriptions to another process over a socket. The sending side passes an array
      of file descriptors and the receiving side receives an array of file
      descriptors. The file descriptors are different in general on both sides but
      refer to the same open file descriptions. The two terms are often conflated,
      even in the official documentation. That’s why I used “FD” above, which could
      mean both “file descriptor” and “file description”.
      c6a3243567b6
    • Manuel Jacob's avatar
      py3: don’t subscript socket.error · b5fe10b3c9f5
      Manuel Jacob authored
      On Python 2, socket.error was subscriptable. On Python 3, socket.error is an
      alias to OSError and is not subscriptable. The except block passes the
      exception to self.send_error(). This fails on both Python 2 (if it was
      executed) and Python 3, as it expects a string.
      
      Getting the attribute .strerror works on Python 2 and Python 3, and has the
      same effect as the previous code on Python 2.
      b5fe10b3c9f5
  5. Jun 06, 2022
    • Anton Shestakov's avatar
      parsers: drop one extra argument to PyErr_Format · 34020d1f1635
      Anton Shestakov authored
      GCC gave the following warning during `make local`:
      
      mercurial/cext/parsers.c: In function 'dirstate_item_from_v1_data':
      mercurial/cext/parsers.c:413:30: warning: too many arguments for format [-Wformat-extra-args]
        413 |                              "unknown state: `%c` (%d, %d, %d)", state, mode,
            |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      To reproduce, you might need to add the -Wformat-extra-args flag, because it
      isn't present for me when building for the default python3. But I can see this
      warning while simply building 6.1 with `make PYTHON=python2 clean local`.
      
      I don't think this NULL was useful, because other instances of PyErr_Format()
      don't have any NULLs as the final argument, but keep in mind that I don't know
      python's C API.
      34020d1f1635
  6. Jun 02, 2022
  7. Jun 03, 2022
  8. May 22, 2022
    • Manuel Jacob's avatar
      worker: avoid potential partial write of pickled data · 395f28064826
      Manuel Jacob authored
      Previously, the code wrote the pickled data using os.write(). However,
      os.write() can write less bytes than passed to it. To trigger the problem, the
      pickled data had to be larger than 2147479552 bytes on my system.
      
      Instead, open a file object and pass it to pickle.dump(). This also has the
      advantage that it doesn’t buffer the whole pickled data in memory.
      
      Note that the opened file must be buffered because pickle doesn’t support
      unbuffered streams because unbuffered streams’ write() method might write less
      bytes than passed to it (like os.write()) but pickle.dump() relies on that all
      bytes are written (see https://github.com/python/cpython/issues/93050).
      
      The side effect of using a file object and a with statement is that wfd is
      explicitly closed now while it seems like before it was implicitly closed by
      process exit.
      395f28064826
  9. Jun 01, 2022
  10. May 31, 2022
  11. May 30, 2022
    • Pierre-Yves David's avatar
      debugindex: move the logic into its own module · 61cf3d39fd9e
      Pierre-Yves David authored
      Adding more information will significantly increase the amount of code. So we
      move the code into its own module before making it more complex.
      61cf3d39fd9e
    • Pierre-Yves David's avatar
      debugindex: rename to debugindex debug-revlog-index · db19f6be0442
      Pierre-Yves David authored
      The command dump some content of the revlog index and omit a lot of
      information. I am going to make it display the missing information.
      
      For clarity, we rename the command to explicitly mention revlog.
      db19f6be0442
    • Manuel Jacob's avatar
      node: stop converting binascii.Error to TypeError in bin() · 63fd0282ad40
      Manuel Jacob authored
      Changeset f574cc00831a introduced the wrapper, to make bin() behave like on
      Python 2, where it raised TypeError in many cases. Another previous approach,
      changing callers to catch binascii.Error in addition to TypeError, was backed
      out after negative review feedback [1].
      
      However, I think it’s worth reconsidering the approach. Now that we’re on
      Python 3 only, callers have to catch only binascii.Error instead of both.
      Catching binascii.Error instead of TypeError has the advantage that it’s less
      likely to cover a programming error (e.g. passing an int to bin() raises
      TypeError). Also, raising TypeError never made sense semantically when bin()
      got an argument of valid type.
      
      As a side-effect, this fixed an exception in test-http-bad-server.t. The TODO
      was outdated: it was not an uncaught ValueError in batch.results() but uncaught
      TypeError from the now removed wrapper. Now that bin() raises binascii.Error
      instead of TypeError, it gets converted to a proper error in
      wirepeer.heads.<locals>.decode() that catches ValueError (superclass of
      binascii.Error). This is a good example of why this changeset is a good idea.
      Catching TypeError instead of ValueError there would not make much sense.
      
      [1] https://phab.mercurial-scm.org/D2244
      63fd0282ad40
  12. May 29, 2022
  13. May 21, 2022
  14. May 24, 2022
    • kiilerix's avatar
      rust: relax im-rc dependency to allow minor updates · 13c37f1c7c4b
      kiilerix authored
      This "15.0.*" requirement came from 0d99778af68a and is now replaced with plain
      "15.0".
      
      AFAICS, it really should allow (but not necessarily require) im-rc 15.1 .
      
      Narrow requirement requirements with wildcard in the version is not used in
      other places.
      13c37f1c7c4b
  15. Jun 02, 2022
  16. May 04, 2022
    • idlsoft's avatar
      narrow_widen_acl: enforce narrowacl in narrow_widen (SEC) · 6b10151b9621
      idlsoft authored
      Reviewer note: this was sent by the author as a simple bugfix, but can be
      considered a security patch, since it allows users to access things outside
      of the ACL, hence the (SEC) prefix.
      
      However, this affects the `narrow` extention which is still marked as
      experimental and has relatively few users aside from large companies with
      their own security layers on top from what we can gather.
      We feel (Alphare: or at least, I feel) like pinging the packaging list is
      enough in this case.
      6.1.3
      6b10151b9621
  17. May 30, 2022
    • Raphaël Gomès's avatar
      chg: ignore already closed fds when cleaning up · 201222849987
      Raphaël Gomès authored
      This should fix this error we see in the CI from time to time:
      
      ```
      --- /tmp/mercurial-ci/tests/test-chg.t
      +++ /tmp/mercurial-ci/tests/test-chg.t.err
      @@ -187,6 +187,26 @@
         $ chg bulkwrite --pager=on --color no --config ui.formatted=True
         paged! 'going to write massive data\n'
         killed! (?)
      +  Traceback (most recent call last):
      +    File "/tmp/hgtests._uvojvqb/install/lib/python/mercurial/commandserver.py", line 509, in _serverequest
      +      sv.cleanup()
      +    File "/tmp/hgtests._uvojvqb/install/lib/python/mercurial/chgserver.py", line 382, in cleanup
      +      self._restoreio()
      +    File "/tmp/hgtests._uvojvqb/install/lib/python/mercurial/chgserver.py", line 461, in _restoreio
      +      os.close(fd)
      +  OSError: [Errno 9] Bad file descriptor
      +  Traceback (most recent call last):
      +    File "/tmp/hgtests._uvojvqb/install/lib/python/mercurial/commandserver.py", line 693, in _acceptnewconnection
      +      self._runworker(conn)
      +    File "/tmp/hgtests._uvojvqb/install/lib/python/mercurial/commandserver.py", line 744, in _runworker
      +      prereposetups=[self._reposetup],
      +    File "/tmp/hgtests._uvojvqb/install/lib/python/mercurial/commandserver.py", line 509, in _serverequest
      +      sv.cleanup()
      +    File "/tmp/hgtests._uvojvqb/install/lib/python/mercurial/chgserver.py", line 382, in cleanup
      +      self._restoreio()
      +    File "/tmp/hgtests._uvojvqb/install/lib/python/mercurial/chgserver.py", line 461, in _restoreio
      +      os.close(fd)
      +  OSError: [Errno 9] Bad file descriptor
         [255]
      ```
      201222849987
Loading