From 65f96bddfac84e5d4136f383abe24053c8c50000 Mon Sep 17 00:00:00 2001 From: David King Date: Sun, 1 Jan 2017 17:56:33 +0000 Subject: [PATCH] Fix intermittent get-pac-test failures https://github.com/libproxy/libproxy/pull/48 --- libproxy-0.4.13-fix-get-pac-test.patch | 55 ++++++++++++++++++++++++++ libproxy.spec | 8 +++- 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 libproxy-0.4.13-fix-get-pac-test.patch diff --git a/libproxy-0.4.13-fix-get-pac-test.patch b/libproxy-0.4.13-fix-get-pac-test.patch new file mode 100644 index 0000000..1c2cf84 --- /dev/null +++ b/libproxy-0.4.13-fix-get-pac-test.patch @@ -0,0 +1,55 @@ +diff -urN libproxy-0.4.13.old/libproxy/test/get-pac-test.cpp libproxy-0.4.13/libproxy/test/get-pac-test.cpp +--- libproxy-0.4.13.old/libproxy/test/get-pac-test.cpp 2016-04-28 18:04:41.000000000 +0100 ++++ libproxy-0.4.13/libproxy/test/get-pac-test.cpp 2017-01-01 16:44:28.736433853 +0000 +@@ -164,7 +164,6 @@ + ret = send(csock, (void*)basic, strlen(basic), 0); + assert(ret == strlen(basic)); + shutdown(csock, SHUT_RDWR); +- close(ret); + } + + void sendTruncated(int csock) +@@ -179,29 +178,27 @@ + ret = send(csock, (void*)basic, strlen(basic), 0); + assert(ret == strlen(basic)); + shutdown(csock, SHUT_RDWR); +- close(ret); + } + + void sendOverflow(int csock) + { + int ret; +- int size = 500000; ++ int size = 50000000; // Must be larger than the kernel TCP receive buffer + char *buf = new char[size]; + memset(buf, 1, size); + + const char *basic = + "HTTP/1.1 200 OK\n" \ + "Content-Type: text/plain\n" \ +- "Content-Length: 500000\n" \ ++ "Content-Length: 50000000\n" \ + "\n"; +- ret = send(csock, (void*)basic, strlen(basic), 0); ++ ret = send(csock, (void*)basic, strlen(basic), MSG_NOSIGNAL); + assert(ret == strlen(basic)); +- ret = send(csock, (void*)buf, size, 0); +- if (!(errno == EBADF)) +- abort(); // Test failed... the socket did not close on us ++ ret = send(csock, (void*)buf, size, MSG_NOSIGNAL); ++ if (ret == size) ++ abort(); // Test failed... the socket should not accept the whole buffer + delete[] buf; + shutdown(csock, SHUT_RDWR); +- close(ret); + } + + void sendChunked(int csock) +@@ -221,7 +218,6 @@ + ret = send(csock, (void*)chunked, strlen(chunked), 0); + assert(ret == strlen(chunked)); + shutdown(csock, SHUT_RDWR); +- close(ret); + } + + in_port_t m_port; diff --git a/libproxy.spec b/libproxy.spec index deb6928..e0db4f1 100644 --- a/libproxy.spec +++ b/libproxy.spec @@ -4,7 +4,7 @@ Name: libproxy Version: 0.4.13 -Release: 5%{?dist} +Release: 1%{?dist} Summary: A library handling all the details of proxy configuration Group: System Environment/Libraries @@ -15,6 +15,9 @@ Source0: https://github.com/libproxy/%{name}/archive/%{version}/%{name}-% Source1: proxy.1 # http://code.google.com/p/libproxy/issues/detail?id=152 Patch0: 0001-Add-config-module-for-querying-PacRunner-d-mon.patch +# Avoid get-pac-test failure. +# https://github.com/libproxy/libproxy/pull/48 +Patch1: libproxy-0.4.13-fix-get-pac-test.patch BuildRequires: libmodman-devel >= 2.0.1 BuildRequires: cmake >= 2.6.0 @@ -161,6 +164,7 @@ developing applications that use %{name}. %prep %autosetup -p1 + %build %{cmake} \ -DMODULE_INSTALL_DIR=%{_libdir}/%{name}/%{version}/modules \ @@ -249,7 +253,7 @@ make test %changelog -* Sun Jan 01 2017 Igor Gnatenko - 0.4.13-5 +* Sun Jan 01 2017 David King - 0.4.13-1 - Update to 0.4.13 * Mon Dec 19 2016 Miro HronĨok - 0.4.12-5