Message ID | 20220712095901.212353-3-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show |
Series | build fixes | expand |
On Tue, Jul 12, 2022 at 4:02 AM Richard Henderson < richard.henderson@linaro.org> wrote: > From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> > > strerror() represents ETIMEDOUT a bit different in Linux and macOS / > FreeBSD. Let's support the latter too. > tl;dr: This change goes back to 1990, but many forks of the BSD networking code and its APIs pre-date that and now FreeBSD and Linux are on different sides of that change... It all starts with 4.2BSD's error string for ETIMEDOUT being: ./4.2/usr/src/sys/h/errno.h:#define ETIMEDOUT 60 /* Connection timed out */ but that changed in 1990 with 4.3reno to (though the kernel version of this file retained the old wording until it was changed in 4.4-LITE): ./4.3reno/usr/include/errno.h:#define ETIMEDOUT 60 /* Operation timed out */ and 4.4 picked it up from there. While MacOS is Mach based (which was 4.3BSD based and the 86 and 92 versions both have the 4.3 wording), it had a large infusion of code from NetBSD/FreeBSD which were derived by then from 4.4-LITE. NET.2 had the 4.3 wording, and early versions of both NetBSD and FreeBSD (as well as 386BSD and the various patchkit versions) had the 4.3 wording, but that all went away with stipulations by the projects to use 4.4-LITE after BSDi related legal action... As far as I can tell (and my historical archives are less complete for Linux), Linux always had the 4.3 wording because, I think, (a) that's what SunOS had and (b) System V had the 4.3 wording starting at System Vr3 when the TCP stack was introduced which took large parts of its code from 4.3BSD. Fixes: 9d05a87b77 ("iotests: copy-before-write: add cases for cbw-timeout > option") > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> > Tested-by: Thomas Huth <thuth@redhat.com> > Reviewed-by: Hanna Reitz <hreitz@redhat.com> > Message-Id: <20220705153708.186418-1-vsementsov@yandex-team.ru> > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > tests/qemu-iotests/tests/copy-before-write | 5 +++++ > 1 file changed, 5 insertions(+) > Reviewed-by: Warner Losh <imp@bsdimp.com> > diff --git a/tests/qemu-iotests/tests/copy-before-write > b/tests/qemu-iotests/tests/copy-before-write > index 16efebbf8f..56937b9dff 100755 > --- a/tests/qemu-iotests/tests/copy-before-write > +++ b/tests/qemu-iotests/tests/copy-before-write > @@ -192,6 +192,11 @@ read 1048576/1048576 bytes at offset 0 > > def test_timeout_break_guest(self): > log = self.do_cbw_timeout('break-guest-write') > + # macOS and FreeBSD tend to represent ETIMEDOUT as > + # "Operation timed out", when Linux prefer > + # "Connection timed out" > + log = log.replace('Operation timed out', > + 'Connection timed out') > self.assertEqual(log, """\ > wrote 524288/524288 bytes at offset 0 > 512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > -- > 2.34.1 > > >
diff --git a/tests/qemu-iotests/tests/copy-before-write b/tests/qemu-iotests/tests/copy-before-write index 16efebbf8f..56937b9dff 100755 --- a/tests/qemu-iotests/tests/copy-before-write +++ b/tests/qemu-iotests/tests/copy-before-write @@ -192,6 +192,11 @@ read 1048576/1048576 bytes at offset 0 def test_timeout_break_guest(self): log = self.do_cbw_timeout('break-guest-write') + # macOS and FreeBSD tend to represent ETIMEDOUT as + # "Operation timed out", when Linux prefer + # "Connection timed out" + log = log.replace('Operation timed out', + 'Connection timed out') self.assertEqual(log, """\ wrote 524288/524288 bytes at offset 0 512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)