Date: Thu, 9 Sep 2021 16:00:39 +0200 From: Stefan Esser <se@freebsd.org> To: FreeBSD CURRENT <freebsd-current@freebsd.org> Subject: fetch -v error output broken? Message-ID: <f82796a3-3cd7-1cdb-f60d-cdb96e8c27b5@freebsd.org>
next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------b2WyyyqEiTC752530x8KGCyi Content-Type: multipart/mixed; boundary="------------QK0Odmm9ZXU3HqtVuNf8hwND"; protected-headers="v1" From: Stefan Esser <se@freebsd.org> To: FreeBSD CURRENT <freebsd-current@freebsd.org> Message-ID: <f82796a3-3cd7-1cdb-f60d-cdb96e8c27b5@freebsd.org> 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: [<html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center> <hr><center>nginx</center> </body> </html> ] 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 "<center>nginx</center>", but "r>ngi= nx" appears twice, 40 bytes apart. "tle>404 Not Found" is a fragment of "<title>404 Not Found</title>", 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f82796a3-3cd7-1cdb-f60d-cdb96e8c27b5>