From nobody Thu Sep 09 14:00:39 2021 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 23D9217B6BB3 for ; Thu, 9 Sep 2021 14:00:42 +0000 (UTC) (envelope-from se@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H50yf0Vbxz3vy1; Thu, 9 Sep 2021 14:00:42 +0000 (UTC) (envelope-from se@freebsd.org) Received: from [IPV6:2003:cd:5f15:5000:3d57:6c49:27f6:fd8d] (p200300cd5f1550003d576c4927f6fd8d.dip0.t-ipconnect.de [IPv6:2003:cd:5f15:5000:3d57:6c49:27f6:fd8d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 99FD5267AC; Thu, 9 Sep 2021 14:00:41 +0000 (UTC) (envelope-from se@freebsd.org) Message-ID: Date: Thu, 9 Sep 2021 16:00:39 +0200 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Content-Language: en-US From: Stefan Esser To: FreeBSD CURRENT Subject: fetch -v error output broken? Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------b2WyyyqEiTC752530x8KGCyi" X-ThisMailContainsUnwantedMimeParts: N This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------b2WyyyqEiTC752530x8KGCyi Content-Type: multipart/mixed; boundary="------------QK0Odmm9ZXU3HqtVuNf8hwND"; protected-headers="v1" From: Stefan Esser To: FreeBSD CURRENT Message-ID: Subject: fetch -v error output broken? --------------QK0Odmm9ZXU3HqtVuNf8hwND Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I have just opened PR 258387 for this issue, which occurred during testin= g of a port with invalid MASTER_SITE. The error output of "fetch -v" should be server messages, but it appears = that the buffer gets overwritten with data of unknown origin (mostly NUL bytes= ), e.g.: $ fetch -v http://distcache.us-west.freebsd.org/x 2>&1 | hd 00000000 72 65 73 6f 6c 76 69 6e 67 20 73 65 72 76 65 72 |resolving se= rver| 00000010 20 61 64 64 72 65 73 73 3a 20 64 69 73 74 63 61 | address: di= stca| 00000020 63 68 65 2e 75 73 2d 77 65 73 74 2e 66 72 65 65 |che.us-west.= free| 00000030 62 73 64 2e 6f 72 67 3a 38 30 0a 72 65 71 75 65 |bsd.org:80.r= eque| 00000040 73 74 69 6e 67 20 68 74 74 70 3a 2f 2f 64 69 73 |sting http:/= /dis| 00000050 74 63 61 63 68 65 2e 75 73 2d 77 65 73 74 2e 66 |tcache.us-we= st.f| 00000060 72 65 65 62 73 64 2e 6f 72 67 2f 78 0a 0d 0a 00 |reebsd.org/x= =2E...| 00000070 67 69 6e 78 00 00 00 0a 34 30 34 20 4e 6f 74 20 |ginx....404 = Not | 00000080 46 6f 75 6e 64 0d 0a 00 00 00 00 00 10 02 00 50 |Found.......= =2E..P| 00000090 95 14 01 c9 00 00 00 00 00 00 00 00 0a 0d 0a 00 |............= =2E...| 000000a0 74 6c 65 3e 34 30 34 20 4e 6f 74 20 46 6f 75 6e |tle>404 Not = Foun| 000000b0 64 0d 0a 00 00 00 00 00 10 02 00 50 95 14 01 c9 |d..........P= =2E...| 000000c0 00 00 00 00 00 00 00 00 0a 34 30 34 20 4e 6f 74 |.........404= Not| 000000d0 20 46 6f 75 6e 64 0d 0a 00 0a 00 00 00 00 00 10 | Found......= =2E...| 000000e0 02 00 50 95 14 01 c9 00 00 00 00 00 00 00 00 0a |..P.........= =2E...| 000000f0 6e 67 69 6e 78 0d 0a 00 3e 0d 0a 00 0a 00 00 00 |nginx...>...= =2E...| 00000100 00 00 10 02 00 50 95 14 01 c9 00 00 00 00 00 00 |.....P......= =2E...| 00000110 00 00 0a 0d 0a 00 72 3e 6e 67 69 6e 78 0d 0a 00 |......r>ngin= x...| 00000120 3e 0d 0a 00 0a 00 00 00 00 00 10 02 00 50 95 14 |>...........= =2EP..| 00000130 01 c9 00 00 00 00 00 00 00 00 0a 0d 0a 00 72 3e |............= =2E.r>| 00000140 6e 67 69 6e 78 0d 0a 00 3e 0d 0a 00 0a 00 00 00 |nginx...>...= =2E...| 00000150 00 00 10 02 00 50 95 14 01 c9 00 00 00 00 00 00 |.....P......= =2E...| 00000160 00 00 0a 66 65 74 63 68 3a 20 68 74 74 70 3a 2f |...fetch: ht= tp:/| 00000170 2f 64 69 73 74 63 61 63 68 65 2e 75 73 2d 77 65 |/distcache.u= s-we| 00000180 73 74 2e 66 72 65 65 62 73 64 2e 6f 72 67 2f 78 |st.freebsd.o= rg/x| 00000190 3a 20 4e 6f 74 20 46 6f 75 6e 64 0a |: Not Found.= | 0000019c The expected output is returned by wget, e.g.: $ wget -d http://distcache.us-west.freebsd.org/x [...] 404 Not Found Registered socket 3 for persistent reuse. Skipping 146 bytes of body: [ 404 Not Found

404 Not Found


nginx
] done. 2021-09-09 15:37:02 ERROR 404: Not Found. Part of the HTML response can be found in the fetch output, too: "r>nginx" is obviously a fragment of "
nginx
", but "r>ngi= nx" appears twice, 40 bytes apart. "tle>404 Not Found" is a fragment of "404 Not Found", with= "404 Not Found" appearing a total of 3 times ... This could be a result of recent changes to the memcpy function, which us= ed to allow overlapping buffers, but does not anymore on -CURRENT. But the 4 occurences of memcpy() in libfetch/http.c and libfetch/common.c= seem to be sane, and I did not look any further for the source of the data cor= ruption. --------------QK0Odmm9ZXU3HqtVuNf8hwND-- --------------b2WyyyqEiTC752530x8KGCyi Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAmE6E4cFAwAAAAAACgkQR+u171r99URX Wgf/aLxaqQxKaP6/UukWgoUNpRe7h2R9CNEeKDxz8woeh2IlmTBsIEOmOPl91h1TbJq8Yq2WRcLL 9Umf5T4i6CV7czP55JfDoa0O7GvxqiUXzjchEry55CyW7OEnIxYYQ5+zHJ+mFX0WwB/XJA3OWUSk PZfomPKCfzdikPD5zzP7ESPq+ijn2OTYtPV3taHvildx+qkFbpD0c/y/RPxj3VwhxCFJWCCW3/81 AHuDjbsFPsYdpdTw49yxY0WUDEvogZ+jwAL4f1B7MfGPQMmk9H73cxjxc9nZzjrp8oQQeE4qZlUk 08/osc7fAJIslvUWtw1qUZkfVnPUGnJh/yQisyr5ag== =7loH -----END PGP SIGNATURE----- --------------b2WyyyqEiTC752530x8KGCyi--