Diff of the two buildlogs: -- --- b1/build.log 2024-10-20 11:29:58.879594538 +0000 +++ b2/build.log 2024-10-20 11:37:24.655724850 +0000 @@ -1,6 +1,6 @@ I: pbuilder: network access will be disabled during build -I: Current time: Sat Oct 19 23:26:34 -12 2024 -I: pbuilder-time-stamp: 1729423594 +I: Current time: Mon Oct 21 01:30:01 +14 2024 +I: pbuilder-time-stamp: 1729423801 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/trixie-reproducible-base.tgz] I: copying local configuration @@ -32,52 +32,84 @@ dpkg-source: info: applying tests-update-strings I: Not using root during the build. I: Installing the build-deps -I: user script /srv/workspace/pbuilder/3214858/tmp/hooks/D02_print_environment starting +I: user script /srv/workspace/pbuilder/1440280/tmp/hooks/D01_modify_environment starting +debug: Running on codethink02-arm64. +I: Changing host+domainname to test build reproducibility +I: Adding a custom variable just for the fun of it... +I: Changing /bin/sh to bash +'/bin/sh' -> '/bin/bash' +lrwxrwxrwx 1 root root 9 Oct 20 11:30 /bin/sh -> /bin/bash +I: Setting pbuilder2's login shell to /bin/bash +I: Setting pbuilder2's GECOS to second user,second room,second work-phone,second home-phone,second other +I: user script /srv/workspace/pbuilder/1440280/tmp/hooks/D01_modify_environment finished +I: user script /srv/workspace/pbuilder/1440280/tmp/hooks/D02_print_environment starting I: set - BUILDDIR='/build/reproducible-path' - BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' - BUILDUSERNAME='pbuilder1' - BUILD_ARCH='arm64' - DEBIAN_FRONTEND='noninteractive' + BASH=/bin/sh + BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath + BASH_ALIASES=() + BASH_ARGC=() + BASH_ARGV=() + BASH_CMDS=() + BASH_LINENO=([0]="12" [1]="0") + BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:. + BASH_SOURCE=([0]="/tmp/hooks/D02_print_environment" [1]="/tmp/hooks/D02_print_environment") + BASH_VERSINFO=([0]="5" [1]="2" [2]="32" [3]="1" [4]="release" [5]="aarch64-unknown-linux-gnu") + BASH_VERSION='5.2.32(1)-release' + BUILDDIR=/build/reproducible-path + BUILDUSERGECOS='second user,second room,second work-phone,second home-phone,second other' + BUILDUSERNAME=pbuilder2 + BUILD_ARCH=arm64 + DEBIAN_FRONTEND=noninteractive DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=12 ' - DISTRIBUTION='trixie' - HOME='/root' - HOST_ARCH='arm64' + DIRSTACK=() + DISTRIBUTION=trixie + EUID=0 + FUNCNAME=([0]="Echo" [1]="main") + GROUPS=() + HOME=/root + HOSTNAME=i-capture-the-hostname + HOSTTYPE=aarch64 + HOST_ARCH=arm64 IFS=' ' - INVOCATION_ID='26937b44cbbb449ca1e7868103d49dbd' - LANG='C' - LANGUAGE='en_US:en' - LC_ALL='C' - MAIL='/var/mail/root' - OPTIND='1' - PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' - PBCURRENTCOMMANDLINEOPERATION='build' - PBUILDER_OPERATION='build' - PBUILDER_PKGDATADIR='/usr/share/pbuilder' - PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' - PBUILDER_SYSCONFDIR='/etc' - PPID='3214858' - PS1='# ' - PS2='> ' + INVOCATION_ID=f9298cf7b3c64ec2a035f0f812df7e5e + LANG=C + LANGUAGE=nl_BE:nl + LC_ALL=C + MACHTYPE=aarch64-unknown-linux-gnu + MAIL=/var/mail/root + OPTERR=1 + OPTIND=1 + OSTYPE=linux-gnu + PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path + PBCURRENTCOMMANDLINEOPERATION=build + PBUILDER_OPERATION=build + PBUILDER_PKGDATADIR=/usr/share/pbuilder + PBUILDER_PKGLIBDIR=/usr/lib/pbuilder + PBUILDER_SYSCONFDIR=/etc + PIPESTATUS=([0]="0") + POSIXLY_CORRECT=y + PPID=1440280 PS4='+ ' - PWD='/' - SHELL='/bin/bash' - SHLVL='2' - SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.uDpcDGWf/pbuilderrc_KnHf --distribution trixie --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/trixie-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.uDpcDGWf/b1 --logfile b1/build.log python-urllib3_2.0.7-2.dsc' - SUDO_GID='109' - SUDO_UID='104' - SUDO_USER='jenkins' - TERM='unknown' - TZ='/usr/share/zoneinfo/Etc/GMT+12' - USER='root' - _='/usr/bin/systemd-run' - http_proxy='http://192.168.101.4:3128' + PWD=/ + SHELL=/bin/bash + SHELLOPTS=braceexpand:errexit:hashall:interactive-comments:posix + SHLVL=3 + SUDO_COMMAND='/usr/bin/timeout -k 24.1h 24h /usr/bin/ionice -c 3 /usr/bin/nice -n 11 /usr/bin/unshare --uts -- /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.uDpcDGWf/pbuilderrc_7XY0 --distribution trixie --hookdir /etc/pbuilder/rebuild-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/trixie-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.uDpcDGWf/b2 --logfile b2/build.log python-urllib3_2.0.7-2.dsc' + SUDO_GID=109 + SUDO_UID=104 + SUDO_USER=jenkins + TERM=unknown + TZ=/usr/share/zoneinfo/Etc/GMT-14 + UID=0 + USER=root + _='I: set' + http_proxy=http://192.168.101.4:3128 I: uname -a - Linux codethink04-arm64 6.1.0-26-cloud-arm64 #1 SMP Debian 6.1.112-1 (2024-09-30) aarch64 GNU/Linux + Linux i-capture-the-hostname 6.1.0-26-cloud-arm64 #1 SMP Debian 6.1.112-1 (2024-09-30) aarch64 GNU/Linux I: ls -l /bin lrwxrwxrwx 1 root root 7 Aug 4 21:30 /bin -> usr/bin -I: user script /srv/workspace/pbuilder/3214858/tmp/hooks/D02_print_environment finished +I: user script /srv/workspace/pbuilder/1440280/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy @@ -230,7 +262,7 @@ Get: 87 http://deb.debian.org/debian trixie/main arm64 python3-socks all 1.7.1+dfsg-1 [23.3 kB] Get: 88 http://deb.debian.org/debian trixie/main arm64 python3-tornado arm64 6.4.1-3 [349 kB] Get: 89 http://deb.debian.org/debian trixie/main arm64 python3-trustme all 1.1.0-1 [11.9 kB] -Fetched 31.6 MB in 0s (136 MB/s) +Fetched 31.6 MB in 1s (34.4 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package libpython3.12-minimal:arm64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 19909 files and directories currently installed.) @@ -531,8 +563,8 @@ Setting up tzdata (2024a-4) ... Current default time zone: 'Etc/UTC' -Local time is now: Sun Oct 20 11:26:53 UTC 2024. -Universal Time is now: Sun Oct 20 11:26:53 UTC 2024. +Local time is now: Sun Oct 20 11:31:00 UTC 2024. +Universal Time is now: Sun Oct 20 11:31:00 UTC 2024. Run 'dpkg-reconfigure tzdata' if you wish to change it. Setting up autotools-dev (20220109.1) ... @@ -622,7 +654,11 @@ Building tag database... -> Finished parsing the build-deps I: Building the package -I: Running cd /build/reproducible-path/python-urllib3-2.0.7/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-genchanges -S > ../python-urllib3_2.0.7-2_source.changes +I: user script /srv/workspace/pbuilder/1440280/tmp/hooks/A99_set_merged_usr starting +Not re-configuring usrmerge for trixie +I: user script /srv/workspace/pbuilder/1440280/tmp/hooks/A99_set_merged_usr finished +hostname: Name or service not known +I: Running cd /build/reproducible-path/python-urllib3-2.0.7/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-genchanges -S > ../python-urllib3_2.0.7-2_source.changes dpkg-buildpackage: info: source package python-urllib3 dpkg-buildpackage: info: source version 2.0.7-2 dpkg-buildpackage: info: source distribution unstable @@ -714,9 +750,596 @@ test/with_dummyserver/test_proxy_poolmanager.py ....s................... [ 94%] ..s....s..s...... [ 94%] test/with_dummyserver/test_socketlevel.py .............................. [ 96%] -............sss......s......................................s.s.s....... [ 99%] +............sss......s..........................FF..........s.s.s....... [ 99%] .............. [100%] +=================================== FAILURES =================================== +__________ TestContentFraming.test_chunked_specified[file-POST-False] __________ + +self = +conn = +method = 'POST', url = '/', body = <_io.BytesIO object at 0xffff8c3a6ac0> +headers = HTTPHeaderDict({}) +retries = Retry(total=False, connect=None, read=None, redirect=0, status=None) +timeout = Timeout(connect=0.5, read=0.5, total=None), chunked = False +response_conn = None, preload_content = True, decode_content = True +enforce_content_length = True + + def _make_request( + self, + conn: BaseHTTPConnection, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | None = None, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + chunked: bool = False, + response_conn: BaseHTTPConnection | None = None, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> BaseHTTPResponse: + """ + Perform a request on a given urllib connection object taken from our + pool. + + :param conn: + a connection from one of our connection pools + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param body: + Data to send in the request body, either :class:`str`, :class:`bytes`, + an iterable of :class:`str`/:class:`bytes`, or a file-like object. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + + :param retries: + Configure the number of retries to allow before raising a + :class:`~urllib3.exceptions.MaxRetryError` exception. + + Pass ``None`` to retry until you receive a response. Pass a + :class:`~urllib3.util.retry.Retry` object for fine-grained control + over different types of retries. + Pass an integer number to retry connection errors that many times, + but no other types of errors. Pass zero to never retry. + + If ``False``, then retries are disabled and any exception is raised + immediately. Also, instead of raising a MaxRetryError on redirects, + the redirect response will be returned. + + :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. + + :param timeout: + If specified, overrides the default timeout for this one + request. It may be a float (in seconds) or an instance of + :class:`urllib3.util.Timeout`. + + :param chunked: + If True, urllib3 will send the body using chunked transfer + encoding. Otherwise, urllib3 will send the body using the standard + content-length form. Defaults to False. + + :param response_conn: + Set this to ``None`` if you will handle releasing the connection or + set the connection to have the response release it. + + :param preload_content: + If True, the response's body will be preloaded during construction. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param enforce_content_length: + Enforce content length checking. Body returned by server must match + value of Content-Length header, if present. Otherwise, raise error. + """ + self.num_requests += 1 + + timeout_obj = self._get_timeout(timeout) + timeout_obj.start_connect() + conn.timeout = Timeout.resolve_default_timeout(timeout_obj.connect_timeout) + + try: + # Trigger any extra validation we need to do. + try: + self._validate_conn(conn) + except (SocketTimeout, BaseSSLError) as e: + self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) + raise + + # _validate_conn() starts the connection to an HTTPS proxy + # so we need to wrap errors with 'ProxyError' here too. + except ( + OSError, + NewConnectionError, + TimeoutError, + BaseSSLError, + CertificateError, + SSLError, + ) as e: + new_e: Exception = e + if isinstance(e, (BaseSSLError, CertificateError)): + new_e = SSLError(e) + # If the connection didn't successfully connect to it's proxy + # then there + if isinstance( + new_e, (OSError, NewConnectionError, TimeoutError, SSLError) + ) and (conn and conn.proxy and not conn.has_connected_to_proxy): + new_e = _wrap_proxy_error(new_e, conn.proxy.scheme) + raise new_e + + # conn.request() calls http.client.*.request, not the method in + # urllib3.request. It also calls makefile (recv) on the socket. + try: + conn.request( + method, + url, + body=body, + headers=headers, + chunked=chunked, + preload_content=preload_content, + decode_content=decode_content, + enforce_content_length=enforce_content_length, + ) + + # We are swallowing BrokenPipeError (errno.EPIPE) since the server is + # legitimately able to close the connection after sending a valid response. + # With this behaviour, the received response is still readable. + except BrokenPipeError: + pass + except OSError as e: + # MacOS/Linux + # EPROTOTYPE is needed on macOS + # https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/ + if e.errno != errno.EPROTOTYPE: + raise + + # Reset the timeout for the recv() on the socket + read_timeout = timeout_obj.read_timeout + + if not conn.is_closed: + # In Python 3 socket.py will catch EAGAIN and return None when you + # try and read into the file pointer created by http.client, which + # instead raises a BadStatusLine exception. Instead of catching + # the exception and assuming all BadStatusLine exceptions are read + # timeouts, check for a zero timeout before making the request. + if read_timeout == 0: + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={read_timeout})" + ) + conn.timeout = read_timeout + + # Receive the response from the server + try: +> response = conn.getresponse() + +urllib3/connectionpool.py:537: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +urllib3/connection.py:461: in getresponse + httplib_response = super().getresponse() +/usr/lib/python3.12/http/client.py:1428: in getresponse + response.begin() +/usr/lib/python3.12/http/client.py:331: in begin + version, status, reason = self._read_status() +/usr/lib/python3.12/http/client.py:292: in _read_status + line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +b = + + def readinto(self, b): + """Read up to len(b) bytes into the writable buffer *b* and return + the number of bytes read. If the socket is non-blocking and no bytes + are available, None is returned. + + If *b* is non-empty, a 0 return value indicates that the connection + was shutdown at the other end. + """ + self._checkClosed() + self._checkReadable() + if self._timeout_occurred: + raise OSError("cannot read from timed out object") + while True: + try: +> return self._sock.recv_into(b) +E TimeoutError: timed out + +/usr/lib/python3.12/socket.py:720: TimeoutError + +The above exception was the direct cause of the following exception: + +self = +method = 'POST', chunked = False, body_type = 'file' + + @pytest.mark.parametrize("chunked", [True, False]) + @pytest.mark.parametrize("method", ["POST", "PUT", "PATCH"]) + @pytest.mark.parametrize("body_type", ["file", "generator", "bytes"]) + def test_chunked_specified( + self, method: str, chunked: bool, body_type: str + ) -> None: + buffer = bytearray() + + def socket_handler(listener: socket.socket) -> None: + nonlocal buffer + sock = listener.accept()[0] + sock.settimeout(0) + + start = time.time() + while time.time() - start < (LONG_TIMEOUT / 2): + try: + buffer += sock.recv(65536) + except OSError: + continue + + sock.sendall( + b"HTTP/1.1 200 OK\r\n" + b"Server: example.com\r\n" + b"Content-Length: 0\r\n\r\n" + ) + sock.close() + + self._start_server(socket_handler) + + body: typing.Any + if body_type == "generator": + + def body_generator() -> typing.Generator[bytes, None, None]: + yield b"x" * 10 + + body = body_generator() + elif body_type == "file": + body = io.BytesIO(b"x" * 10) + body.seek(0, 0) + else: + if chunked is False: + pytest.skip("urllib3 uses Content-Length in this case") + body = b"x" * 10 + + with HTTPConnectionPool( + self.host, self.port, timeout=LONG_TIMEOUT, retries=False + ) as pool: +> resp = pool.request(method, "/", chunked=chunked, body=body) + +test/with_dummyserver/test_socketlevel.py:2302: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +urllib3/_request_methods.py:118: in request + return self.request_encode_body( +urllib3/_request_methods.py:217: in request_encode_body + return self.urlopen(method, url, **extra_kw) +urllib3/connectionpool.py:845: in urlopen + retries = retries.increment( +urllib3/util/retry.py:445: in increment + raise reraise(type(error), error, _stacktrace) +urllib3/util/util.py:39: in reraise + raise value +urllib3/connectionpool.py:791: in urlopen + response = self._make_request( +urllib3/connectionpool.py:539: in _make_request + self._raise_timeout(err=e, url=url, timeout_value=read_timeout) +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +err = TimeoutError('timed out'), url = '/', timeout_value = 0.5 + + def _raise_timeout( + self, + err: BaseSSLError | OSError | SocketTimeout, + url: str, + timeout_value: _TYPE_TIMEOUT | None, + ) -> None: + """Is the error actually a timeout? Will raise a ReadTimeout or pass""" + + if isinstance(err, SocketTimeout): +> raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={timeout_value})" + ) from err +E urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=39295): Read timed out. (read timeout=0.5) + +urllib3/connectionpool.py:371: ReadTimeoutError +___________ TestContentFraming.test_chunked_specified[file-PUT-True] ___________ + +self = +conn = +method = 'PUT', url = '/', body = <_io.BytesIO object at 0xffff8c1f8a40> +headers = HTTPHeaderDict({}) +retries = Retry(total=False, connect=None, read=None, redirect=0, status=None) +timeout = Timeout(connect=0.5, read=0.5, total=None), chunked = True +response_conn = None, preload_content = True, decode_content = True +enforce_content_length = True + + def _make_request( + self, + conn: BaseHTTPConnection, + method: str, + url: str, + body: _TYPE_BODY | None = None, + headers: typing.Mapping[str, str] | None = None, + retries: Retry | None = None, + timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, + chunked: bool = False, + response_conn: BaseHTTPConnection | None = None, + preload_content: bool = True, + decode_content: bool = True, + enforce_content_length: bool = True, + ) -> BaseHTTPResponse: + """ + Perform a request on a given urllib connection object taken from our + pool. + + :param conn: + a connection from one of our connection pools + + :param method: + HTTP request method (such as GET, POST, PUT, etc.) + + :param url: + The URL to perform the request on. + + :param body: + Data to send in the request body, either :class:`str`, :class:`bytes`, + an iterable of :class:`str`/:class:`bytes`, or a file-like object. + + :param headers: + Dictionary of custom headers to send, such as User-Agent, + If-None-Match, etc. If None, pool headers are used. If provided, + these headers completely replace any pool-specific headers. + + :param retries: + Configure the number of retries to allow before raising a + :class:`~urllib3.exceptions.MaxRetryError` exception. + + Pass ``None`` to retry until you receive a response. Pass a + :class:`~urllib3.util.retry.Retry` object for fine-grained control + over different types of retries. + Pass an integer number to retry connection errors that many times, + but no other types of errors. Pass zero to never retry. + + If ``False``, then retries are disabled and any exception is raised + immediately. Also, instead of raising a MaxRetryError on redirects, + the redirect response will be returned. + + :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. + + :param timeout: + If specified, overrides the default timeout for this one + request. It may be a float (in seconds) or an instance of + :class:`urllib3.util.Timeout`. + + :param chunked: + If True, urllib3 will send the body using chunked transfer + encoding. Otherwise, urllib3 will send the body using the standard + content-length form. Defaults to False. + + :param response_conn: + Set this to ``None`` if you will handle releasing the connection or + set the connection to have the response release it. + + :param preload_content: + If True, the response's body will be preloaded during construction. + + :param decode_content: + If True, will attempt to decode the body based on the + 'content-encoding' header. + + :param enforce_content_length: + Enforce content length checking. Body returned by server must match + value of Content-Length header, if present. Otherwise, raise error. + """ + self.num_requests += 1 + + timeout_obj = self._get_timeout(timeout) + timeout_obj.start_connect() + conn.timeout = Timeout.resolve_default_timeout(timeout_obj.connect_timeout) + + try: + # Trigger any extra validation we need to do. + try: + self._validate_conn(conn) + except (SocketTimeout, BaseSSLError) as e: + self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) + raise + + # _validate_conn() starts the connection to an HTTPS proxy + # so we need to wrap errors with 'ProxyError' here too. + except ( + OSError, + NewConnectionError, + TimeoutError, + BaseSSLError, + CertificateError, + SSLError, + ) as e: + new_e: Exception = e + if isinstance(e, (BaseSSLError, CertificateError)): + new_e = SSLError(e) + # If the connection didn't successfully connect to it's proxy + # then there + if isinstance( + new_e, (OSError, NewConnectionError, TimeoutError, SSLError) + ) and (conn and conn.proxy and not conn.has_connected_to_proxy): + new_e = _wrap_proxy_error(new_e, conn.proxy.scheme) + raise new_e + + # conn.request() calls http.client.*.request, not the method in + # urllib3.request. It also calls makefile (recv) on the socket. + try: + conn.request( + method, + url, + body=body, + headers=headers, + chunked=chunked, + preload_content=preload_content, + decode_content=decode_content, + enforce_content_length=enforce_content_length, + ) + + # We are swallowing BrokenPipeError (errno.EPIPE) since the server is + # legitimately able to close the connection after sending a valid response. + # With this behaviour, the received response is still readable. + except BrokenPipeError: + pass + except OSError as e: + # MacOS/Linux + # EPROTOTYPE is needed on macOS + # https://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/ + if e.errno != errno.EPROTOTYPE: + raise + + # Reset the timeout for the recv() on the socket + read_timeout = timeout_obj.read_timeout + + if not conn.is_closed: + # In Python 3 socket.py will catch EAGAIN and return None when you + # try and read into the file pointer created by http.client, which + # instead raises a BadStatusLine exception. Instead of catching + # the exception and assuming all BadStatusLine exceptions are read + # timeouts, check for a zero timeout before making the request. + if read_timeout == 0: + raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={read_timeout})" + ) + conn.timeout = read_timeout + + # Receive the response from the server + try: +> response = conn.getresponse() + +urllib3/connectionpool.py:537: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +urllib3/connection.py:461: in getresponse + httplib_response = super().getresponse() +/usr/lib/python3.12/http/client.py:1428: in getresponse + response.begin() +/usr/lib/python3.12/http/client.py:331: in begin + version, status, reason = self._read_status() +/usr/lib/python3.12/http/client.py:292: in _read_status + line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +b = + + def readinto(self, b): + """Read up to len(b) bytes into the writable buffer *b* and return + the number of bytes read. If the socket is non-blocking and no bytes + are available, None is returned. + + If *b* is non-empty, a 0 return value indicates that the connection + was shutdown at the other end. + """ + self._checkClosed() + self._checkReadable() + if self._timeout_occurred: + raise OSError("cannot read from timed out object") + while True: + try: +> return self._sock.recv_into(b) +E TimeoutError: timed out + +/usr/lib/python3.12/socket.py:720: TimeoutError + +The above exception was the direct cause of the following exception: + +self = +method = 'PUT', chunked = True, body_type = 'file' + + @pytest.mark.parametrize("chunked", [True, False]) + @pytest.mark.parametrize("method", ["POST", "PUT", "PATCH"]) + @pytest.mark.parametrize("body_type", ["file", "generator", "bytes"]) + def test_chunked_specified( + self, method: str, chunked: bool, body_type: str + ) -> None: + buffer = bytearray() + + def socket_handler(listener: socket.socket) -> None: + nonlocal buffer + sock = listener.accept()[0] + sock.settimeout(0) + + start = time.time() + while time.time() - start < (LONG_TIMEOUT / 2): + try: + buffer += sock.recv(65536) + except OSError: + continue + + sock.sendall( + b"HTTP/1.1 200 OK\r\n" + b"Server: example.com\r\n" + b"Content-Length: 0\r\n\r\n" + ) + sock.close() + + self._start_server(socket_handler) + + body: typing.Any + if body_type == "generator": + + def body_generator() -> typing.Generator[bytes, None, None]: + yield b"x" * 10 + + body = body_generator() + elif body_type == "file": + body = io.BytesIO(b"x" * 10) + body.seek(0, 0) + else: + if chunked is False: + pytest.skip("urllib3 uses Content-Length in this case") + body = b"x" * 10 + + with HTTPConnectionPool( + self.host, self.port, timeout=LONG_TIMEOUT, retries=False + ) as pool: +> resp = pool.request(method, "/", chunked=chunked, body=body) + +test/with_dummyserver/test_socketlevel.py:2302: +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ +urllib3/_request_methods.py:118: in request + return self.request_encode_body( +urllib3/_request_methods.py:217: in request_encode_body + return self.urlopen(method, url, **extra_kw) +urllib3/connectionpool.py:845: in urlopen + retries = retries.increment( +urllib3/util/retry.py:445: in increment + raise reraise(type(error), error, _stacktrace) +urllib3/util/util.py:39: in reraise + raise value +urllib3/connectionpool.py:791: in urlopen + response = self._make_request( +urllib3/connectionpool.py:539: in _make_request + self._raise_timeout(err=e, url=url, timeout_value=read_timeout) +_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + +self = +err = TimeoutError('timed out'), url = '/', timeout_value = 0.5 + + def _raise_timeout( + self, + err: BaseSSLError | OSError | SocketTimeout, + url: str, + timeout_value: _TYPE_TIMEOUT | None, + ) -> None: + """Is the error actually a timeout? Will raise a ReadTimeout or pass""" + + if isinstance(err, SocketTimeout): +> raise ReadTimeoutError( + self, url, f"Read timed out. (read timeout={timeout_value})" + ) from err +E urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=42405): Read timed out. (read timeout=0.5) + +urllib3/connectionpool.py:371: ReadTimeoutError =============================== warnings summary =============================== test/contrib/test_pyopenssl.py: 4 warnings test/with_dummyserver/test_https.py: 14 warnings @@ -751,13 +1374,13 @@ ctx = ssl.SSLContext(ssl_version) test/contrib/test_pyopenssl.py::TestHTTPS_TLSv1_2::test_server_hostname - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/contrib/test_pyopenssl.py::TestHTTPS_TLSv1_3::test_server_hostname - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. @@ -772,7 +1395,7 @@ warnings.warn("No IPv6 support. Falling back to IPv4.", NoIPv6Warning) test/contrib/test_pyopenssl.py: 14 warnings -test/with_dummyserver/test_socketlevel.py: 16 warnings +test/with_dummyserver/test_socketlevel.py: 15 warnings /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/test/with_dummyserver/test_socketlevel.py:160: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated context = ssl.SSLContext(ssl_version) @@ -793,13 +1416,13 @@ context.maximum_version = ssl_maximum_version test/test_ssltransport.py::SingleTLSLayerTestCase::test_unwrap_existing_socket - /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/dummyserver/server.py:146: ResourceWarning: unclosed + /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/dummyserver/server.py:146: ResourceWarning: unclosed self.socket_handler(sock) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/test_ssltransport.py::SingleTLSLayerTestCase::test_unwrap_existing_socket - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. @@ -809,26 +1432,26 @@ return self.sslobj.selected_npn_protocol() test/with_dummyserver/test_connection.py::test_returns_urllib3_HTTPResponse - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connection.py::test_does_not_release_conn - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connection.py::test_double_getresponse - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connectionpool.py::TestConnectionPoolTimeouts::test_timeout_float - /usr/lib/python3.12/email/message.py:150: ResourceWarning: unclosed - def __init__(self, policy=compat32): + /usr/lib/python3.12/email/parser.py:49: ResourceWarning: unclosed + feedparser = FeedParser(self._class, policy=self.policy) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. @@ -837,67 +1460,67 @@ warnings.warn("No IPv6 support: skipping.", NoIPv6Warning) test/with_dummyserver/test_connectionpool.py::TestConnectionPool::test_headers_not_modified_by_request[dict-False-True] - /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/test/with_dummyserver/test_connectionpool.py:1072: ResourceWarning: unclosed + /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/test/with_dummyserver/test_connectionpool.py:1072: ResourceWarning: unclosed conn = pool._get_conn() Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connectionpool.py::TestConnectionPool::test_headers_not_modified_by_request[dict-False-True] - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connectionpool.py::TestConnectionPool::test_headers_not_modified_by_request[dict-False-False] - /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/test/with_dummyserver/test_connectionpool.py:1072: ResourceWarning: unclosed + /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/test/with_dummyserver/test_connectionpool.py:1072: ResourceWarning: unclosed conn = pool._get_conn() Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connectionpool.py::TestConnectionPool::test_headers_not_modified_by_request[dict-False-False] - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connectionpool.py::TestConnectionPool::test_headers_not_modified_by_request[HTTPHeaderDict-False-True] - /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/test/with_dummyserver/test_connectionpool.py:1072: ResourceWarning: unclosed + /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/test/with_dummyserver/test_connectionpool.py:1072: ResourceWarning: unclosed conn = pool._get_conn() Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connectionpool.py::TestConnectionPool::test_headers_not_modified_by_request[HTTPHeaderDict-False-True] - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connectionpool.py::TestConnectionPool::test_headers_not_modified_by_request[HTTPHeaderDict-False-False] - /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/test/with_dummyserver/test_connectionpool.py:1072: ResourceWarning: unclosed + /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/test/with_dummyserver/test_connectionpool.py:1072: ResourceWarning: unclosed conn = pool._get_conn() Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connectionpool.py::TestConnectionPool::test_headers_not_modified_by_request[HTTPHeaderDict-False-False] - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_connectionpool.py::TestConnectionPool::test_request_chunked_is_deprecated - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_https.py::TestHTTPS_TLSv1_2::test_server_hostname - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. test/with_dummyserver/test_https.py::TestHTTPS_TLSv1_3::test_server_hostname - /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed + /usr/lib/python3/dist-packages/_pytest/python.py:159: ResourceWarning: unclosed result = testfunction(**testargs) Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. @@ -915,56 +1538,41 @@ /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build/test/with_dummyserver/test_socketlevel.py:403: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated context = ssl_.SSLContext(ssl_.PROTOCOL_SSLv23) +test/with_dummyserver/test_socketlevel.py::TestSSL::test_ssl_dont_load_default_certs_when_given + /usr/lib/python3.12/unittest/mock.py:2195: ResourceWarning: unclosed + def __init__(self, name, parent): + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html -== 1687 passed, 575 skipped, 45 deselected, 295 warnings in 158.75s (0:02:38) == -sys:1: ResourceWarning: unclosed +=========================== short test summary info ============================ +FAILED test/with_dummyserver/test_socketlevel.py::TestContentFraming::test_chunked_specified[file-POST-False] - urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=39295): Read timed out. (read timeout=0.5) +FAILED test/with_dummyserver/test_socketlevel.py::TestContentFraming::test_chunked_specified[file-PUT-True] - urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=42405): Read timed out. (read timeout=0.5) += 2 failed, 1685 passed, 575 skipped, 45 deselected, 295 warnings in 270.41s (0:04:30) = +sys:1: ResourceWarning: unclosed ResourceWarning: Enable tracemalloc to get the object allocation traceback -sys:1: ResourceWarning: unclosed +sys:1: ResourceWarning: unclosed ResourceWarning: Enable tracemalloc to get the object allocation traceback -sys:1: ResourceWarning: unclosed +sys:1: ResourceWarning: unclosed ResourceWarning: Enable tracemalloc to get the object allocation traceback -sys:1: ResourceWarning: unclosed +sys:1: ResourceWarning: unclosed ResourceWarning: Enable tracemalloc to get the object allocation traceback -sys:1: ResourceWarning: unclosed -ResourceWarning: Enable tracemalloc to get the object allocation traceback - create-stamp debian/debhelper-build-stamp - dh_testroot -O--buildsystem=pybuild - dh_prep -O--buildsystem=pybuild - dh_auto_install --destdir=debian/python3-urllib3/ -O--buildsystem=pybuild -I: pybuild plugin_pyproject:178: Copying package built for python3.12 to destdir - dh_installdocs -O--buildsystem=pybuild - debian/rules override_dh_installchangelogs -make[1]: Entering directory '/build/reproducible-path/python-urllib3-2.0.7' -dh_installchangelogs CHANGES.rst -make[1]: Leaving directory '/build/reproducible-path/python-urllib3-2.0.7' - dh_python3 -O--buildsystem=pybuild -I: dh_python3 pydist:325: Ignoring complex environment marker: brotli>=1.0.9; (platform_python_implementation == 'CPython') and extra == 'brotli' -I: dh_python3 pydist:325: Ignoring complex environment marker: brotlicffi>=0.8.0; (platform_python_implementation != 'CPython') and extra == 'brotli' - dh_installsystemduser -O--buildsystem=pybuild - dh_perl -O--buildsystem=pybuild - dh_link -O--buildsystem=pybuild - dh_strip_nondeterminism -O--buildsystem=pybuild - dh_compress -O--buildsystem=pybuild - dh_fixperms -O--buildsystem=pybuild - dh_missing -O--buildsystem=pybuild - dh_installdeb -O--buildsystem=pybuild - dh_gencontrol -O--buildsystem=pybuild - dh_md5sums -O--buildsystem=pybuild - dh_builddeb -O--buildsystem=pybuild -dpkg-deb: building package 'python3-urllib3' in '../python3-urllib3_2.0.7-2_all.deb'. - dpkg-genbuildinfo --build=binary -O../python-urllib3_2.0.7-2_arm64.buildinfo - dpkg-genchanges --build=binary -O../python-urllib3_2.0.7-2_arm64.changes -dpkg-genchanges: info: binary-only upload (no source code included) - dpkg-source --after-build . -dpkg-buildpackage: info: binary-only upload (no source included) -dpkg-genchanges: info: not including original source code in upload +E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /build/reproducible-path/python-urllib3-2.0.7/.pybuild/cpython3_3.12_urllib3/build; python3.12 -m pytest -k "not requires_network and not test_recent_date" +dh_auto_test: error: pybuild --test -i python{version} -p 3.12 returned exit code 13 +make: *** [debian/rules:11: binary] Error 25 +dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2 I: copying local configuration +E: Failed autobuilding of package +I: user script /srv/workspace/pbuilder/1440280/tmp/hooks/C01_cleanup starting +debug output: disk usage on i-capture-the-hostname at Sun Oct 20 11:37:22 UTC 2024 +Filesystem Size Used Avail Use% Mounted on +tmpfs 30G 0 30G 0% /dev/shm + +I: user script /srv/workspace/pbuilder/1440280/tmp/hooks/C01_cleanup finished I: unmounting dev/ptmx filesystem I: unmounting dev/pts filesystem I: unmounting dev/shm filesystem I: unmounting proc filesystem I: unmounting sys filesystem I: cleaning the build env -I: removing directory /srv/workspace/pbuilder/3214858 and its subdirectories -I: Current time: Sat Oct 19 23:29:57 -12 2024 -I: pbuilder-time-stamp: 1729423797 +I: removing directory /srv/workspace/pbuilder/1440280 and its subdirectories