Your message dated Tue, 13 Aug 2024 21:22:51 +0000
with message-id <e1sdyyh-00aptb...@fasolo.debian.org>
and subject line Bug#1078649: fixed in python-test-tunnel 0.1.1-2
has caused the Debian Bug report #1078649,
regarding [python-test-tunnel] Reconnect fails on the GNU Hurd, recreate the 
socket instead
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
1078649: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1078649
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Source: python-test-tunnel
Version: 0.1.1-1
Severity: normal
Tags: patch upstream
X-Debbugs-Cc: r...@debian.org

The build of the microsocks package on the GNU Hurd failed:
  
https://buildd.debian.org/status/fetch.php?pkg=microsocks&arch=hurd-i386&ver=1.0.4-1&stamp=1723504380&raw=0
...because the Hurd does not allow a second connect(2) call on
the same TCP socket once the first one has failed.

Attached is the upstream patch that will be included in
the 0.2.0 upstream release.

G'luck,
Peter


-- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable-updates'), (500, 
'stable-security'), (500, 'oldstable-updates'), (500, 'oldstable-security'), 
(500, 'oldoldstable-updates'), (500, 'oldoldstable'), (500, 'stable'), (500, 
'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.10.3-amd64 (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

commit f25568c7c05957eedcc5deeab964fba8baeb4956
Author: Peter Pentchev <r...@ringlet.net>
Date:   Tue Aug 13 21:49:44 2024 +0300

    Recreate the client socket on connection failure
    
    At least on the GNU Hurd, a failed connect(2) call will leave
    the socket in a half-initialized state, and a later connect(2)
    call, even to the same destination, will fail with an EINVAL
    ("invalid argument") error. Thus, if our attempt to connect to
    the proxy server fails with a "connection refused" error,
    recreate the socket from scratch instead of invoking connect(2)
    on the same one again.

diff --git a/src/test_tunnel/run_test.py b/src/test_tunnel/run_test.py
index 7b53213..045a162 100644
--- a/src/test_tunnel/run_test.py
+++ b/src/test_tunnel/run_test.py
@@ -63,12 +63,14 @@ class TestTunnel(abc.ABC):
         """
         raise NotImplementedError
 
-    def do_test_conn_connect(
+    @contextlib.contextmanager
+    def do_test_conn_bind_and_connect(
         self,
-        cli_sock: socket.socket,
+        local_address: addresses.Address,
+        local_port: int,
         address: addresses.Address,
         port: int,
-    ) -> None:
+    ) -> Iterator[socket.socket]:
         """Connect to the specified address/port.
 
         This method is invoked internally by `run()` to make sure that the 
tunnel/proxy
@@ -76,19 +78,25 @@ class TestTunnel(abc.ABC):
         the addresses it should have been configured to listen on.
         """
         dest: Final = (address.address, port)
-        self.cfg.log.info(
-            "Connecting to the %(slug)s server at %(dest)r",
-            {"slug": self.slug(), "dest": dest},
-        )
         for _ in range(10):
-            try:
-                cli_sock.connect(dest)
+            self.cfg.log.info("Creating the client socket")
+            with addresses.bind_to(self.cfg, local_address, local_port) as 
cli_sock:
+                self.cfg.log.debug("Client socket: %(cli_sock)r", {"cli_sock": 
cli_sock})
+                self.cfg.log.info(
+                    "Connecting to the %(slug)s server at %(dest)r",
+                    {"slug": self.slug(), "dest": dest},
+                )
+                try:
+                    cli_sock.connect(dest)
+                except OSError as err:
+                    if err.errno != errno.ECONNREFUSED:
+                        raise
+                    self.cfg.log.debug("Could not connect, waiting for a 
second")
+                    time.sleep(1)
+                    continue
+
+                yield cli_sock
                 break
-            except OSError as err:
-                if err.errno != errno.ECONNREFUSED:
-                    raise
-                self.cfg.log.debug("Could not connect, waiting for a second")
-                time.sleep(1)
         else:
             sys.exit(f"Could not connect to the {self.slug()} server at {dest} 
after ten attempts")
 
@@ -234,20 +242,13 @@ class TestTunnel(abc.ABC):
                 )
 
                 try:
-                    self.cfg.log.info("Creating the client socket")
-                    with addresses.bind_to(
-                        self.cfg,
+                    with self.do_test_conn_bind_and_connect(
                         proxy_listen.clients[0],
                         proxy_listen.proxy_port,
+                        proxy_listen.address,
+                        proxy_listen.svc_port,
                     ) as cli_sock:
-                        self.cfg.log.debug("Client socket: %(cli_sock)r", 
{"cli_sock": cli_sock})
-                        self.do_test_conn_connect(
-                            cli_sock,
-                            proxy_listen.address,
-                            proxy_listen.svc_port,
-                        )
                         self.cfg.log.debug("- connected: %(cli_sock)r", 
{"cli_sock": cli_sock})
-
                         self.do_test_conn_xfer(cli_sock, srv_sock, svc_listen)
 
                     self.cfg.log.debug("Stopping the %(slug)s server", 
{"slug": self.slug()})

Attachment: signature.asc
Description: PGP signature


--- End Message ---
--- Begin Message ---
Source: python-test-tunnel
Source-Version: 0.1.1-2
Done: Peter Pentchev <r...@debian.org>

We believe that the bug you reported is fixed in the latest version of
python-test-tunnel, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1078...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Peter Pentchev <r...@debian.org> (supplier of updated python-test-tunnel 
package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Tue, 13 Aug 2024 23:56:01 +0300
Source: python-test-tunnel
Architecture: source
Version: 0.1.1-2
Distribution: unstable
Urgency: medium
Maintainer: Debian Python Team <team+pyt...@tracker.debian.org>
Changed-By: Peter Pentchev <r...@debian.org>
Closes: 1078649
Changes:
 python-test-tunnel (0.1.1-2) unstable; urgency=medium
 .
   * Run the microsocks test at build time, too.
   * Add the reconnect-recreate upstream patch. Closes: #1078649
Checksums-Sha1:
 81a13ad7ed81b06112ee62bdbb3292720a047898 2789 python-test-tunnel_0.1.1-2.dsc
 13ef1414a3a28a1b073c3011a898d5c05569a4b8 6500 
python-test-tunnel_0.1.1-2.debian.tar.xz
Checksums-Sha256:
 9288739efd8ad67ae5c1d035d99f9858052e66e327c4f3a56cd3abb0cf919ac1 2789 
python-test-tunnel_0.1.1-2.dsc
 c6db39288b498ecc8e024cbb517bbbafd04ab3bf7b5e1b605013bf39d4028228 6500 
python-test-tunnel_0.1.1-2.debian.tar.xz
Files:
 389e43996141328d017f88394a9d2d89 2789 python optional 
python-test-tunnel_0.1.1-2.dsc
 b55ae4357807c47b30e1c9806cb1f85d 6500 python optional 
python-test-tunnel_0.1.1-2.debian.tar.xz

-----BEGIN PGP SIGNATURE-----

iQJEBAEBCgAuFiEELuenpRf8EkzxFcNUZR7vsCUn3xMFAma7ygMQHHJvYW1AZGVi
aWFuLm9yZwAKCRBlHu+wJSffE9d+EACL1z6uWIqrMvzqNeeuMbezw8YO8JQOoD5T
ZZQpJiajmzA/KjingQNOi8Xnioep6mwH8OUXvVezsW51TywhQHxHNpJGFSVuU3Aq
zFAWZqC5yZXz2TlaXdxadaFRTXQYppNh1DRoTyxGnJaCkFvQEWZ+NjQifZcqWqC8
5BxqP4t7LF1LgMKt25lCNGoqPO87UEYQ9cRh5rdpPsXKyE2Yw6Q84KBV0tLFAgSc
74tBIiC3VFPtWoHBsjH5E6FwSdQo795ato+sCj5ZD2R+4fzH+2v65jN92YN+ZNwj
QbkPUvxEJHUqs4j8Ut8PtyymLKkK0mQcQRoSxMLHgb2XdNSIfvj2pdEYBH3IQ62k
YeHJYCHtYhGcCtVlyxE8SCwxeZQE5EGRWf3wGQb1W5wTcUEtvQK9J0tRUxUpE8RD
9x+sj5REjtn/NfSd/gavD5RCdAcMNkJuE24ROOugyXN6OzOJJI0iaeA2mLfkXv9p
ZoKzZXVES7eZlWeP72FC3Q2qMniIjuQm34rVP/70XOk515xcsMLBQS813tnSPsL/
trr9hamC+DyrpqDG5ijfHfFTUvrpxGyKK5bjWdNGb2ishp85p/oUio8DVu3CgTtn
b+oj2rcYn6NJ6/xztDEa1eFQ2Mdl5cetOwdYCS7satiF3ppVZkrP/l1700PDbEiT
VYG+f6N2bQ==
=CUZ/
-----END PGP SIGNATURE-----

Attachment: pgp9Dqfb12Nb_.pgp
Description: PGP signature


--- End Message ---

Reply via email to