From 90605f4d8da9741bda909202d8ecf837602395419ed2ca2a875966776c3326cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 7 Jan 2020 18:03:05 +0000 Subject: [PATCH 1/2] Accepting request 761665 from home:TheBlackCat:branches:devel:libraries:c_c++ - Switch to cmake-based build. Some packages need the cmake build files. This version runs atest OBS-URL: https://build.opensuse.org/request/show/761665 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/c-ares?expand=0&rev=15 --- c-ares.changes | 6 ++++ c-ares.spec | 76 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 58 insertions(+), 24 deletions(-) diff --git a/c-ares.changes b/c-ares.changes index 94da0c2..383368c 100644 --- a/c-ares.changes +++ b/c-ares.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jan 6 17:54:05 UTC 2020 - Todd R + +- Switch to cmake-based build. + Some packages need the cmake build files. + ------------------------------------------------------------------- Fri Nov 15 07:59:27 UTC 2019 - Tomáš Chvátal diff --git a/c-ares.spec b/c-ares.spec index d58902a..b88cf5d 100644 --- a/c-ares.spec +++ b/c-ares.spec @@ -1,7 +1,7 @@ # # spec file for package c-ares # -# Copyright (c) 2019 SUSE LLC. +# Copyright (c) 2020 SUSE LLC. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,14 +16,14 @@ # -%define libname libcares2 +%define sonum 2 +%define libname libcares%{sonum} %define realver 1.15.0-20191108 Name: c-ares Version: 1.15.0+20191108 Release: 0 Summary: Library for asynchronous name resolves License: MIT -Group: Development/Libraries/C and C++ URL: https://c-ares.haxx.se/ #Source0: https://c-ares.haxx.se/daily-snapshot/c-ares-%{realver}.tar.gz Source0: c-ares-%{realver}.tar.gz @@ -33,8 +33,7 @@ Source3: %{name}.keyring Source4: baselibs.conf Patch0: 0001-Use-RPM-compiler-options.patch Patch1: disable-live-tests.patch -BuildRequires: autoconf -BuildRequires: automake +BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: libtool BuildRequires: pkgconfig @@ -44,18 +43,30 @@ c-ares is a C library that performs DNS requests and name resolves asynchronously. c-ares is a fork of the library named 'ares', written by Greg Hudson at MIT. -%package -n %{libname} +%package utils +Summary: Tools for asynchronous name resolves + +%description utils +c-ares is a C library that performs DNS requests and name resolves +asynchronously. c-ares is a fork of the library named 'ares', written +by Greg Hudson at MIT. + +This package provides some tools that make use of c-ares. + + +%package -n %{libname} Summary: Library for asynchronous name resolves -Group: System/Libraries %description -n %{libname} c-ares is a C library that performs DNS requests and name resolves asynchronously. c-ares is a fork of the library named 'ares', written by Greg Hudson at MIT. +This package provides the shared libraries for c-ares. + + %package devel -Summary: Library for asynchronous name resolves -Group: Development/Libraries/C and C++ +Summary: Development files for %{name} Requires: %{libname} = %{version} Requires: glibc-devel Provides: libcares-devel = %{version} @@ -66,6 +77,10 @@ c-ares is a C library that performs DNS requests and name resolves asynchronously. c-ares is a fork of the library named 'ares', written by Greg Hudson at MIT. +This package provides the development libraries and headers needed +to build packages that depend on c-ares. + + %prep %autosetup -p1 -n %{name}-%{realver} @@ -74,35 +89,48 @@ sed -i -e '/XC_CHECK_BUILD_FLAGS/d' configure.ac sed -i -e '/XC_CHECK_USER_FLAGS/d' m4/xc-cc-check.m4 %build -autoreconf -fiv -%configure \ - --disable-silent-rules \ - --enable-symbol-hiding \ - --enable-nonblocking \ - --enable-shared \ - --disable-static \ - --enable-tests +%cmake \ + -DCARES_STATIC:BOOL=OFF \ + -DCARES_SHARED:BOOL=ON \ + -DCARES_INSTALL:BOOL=ON \ + -DCARES_BUILD_TESTS:BOOL=ON \ + -DCARES_BUILD_TOOLS:BOOL=ON make %{?_smp_mflags} -%check -make -C test %{?_smp_mflags} -./test/arestest - %install -%make_install +%cmake_install +install -m 644 -Dt %{buildroot}%{_mandir}/man1/ *.1 +install -m 644 -Dt %{buildroot}%{_mandir}/man3/ *.3 find %{buildroot} -type f -name "*.la" -delete -print -%post -n %{libname} -p /sbin/ldconfig +%check +pushd build +make -C test %{?_smp_mflags} +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib +./bin/arestest + +%post -n %{libname} -p /sbin/ldconfig %postun -n %{libname} -p /sbin/ldconfig +%files utils +%license LICENSE.md +%{_bindir}/acountry +%{_bindir}/adig +%{_bindir}/ahost +%{_mandir}/man1/acountry.1%{ext_man} +%{_mandir}/man1/adig.1%{ext_man} +%{_mandir}/man1/ahost.1%{ext_man} + %files -n %{libname} %license LICENSE.md %{_libdir}/libcares.so.2* %files devel +%license LICENSE.md %{_libdir}/libcares.so %{_includedir}/*.h -%{_mandir}/man3/ares_* +%{_mandir}/man3/ares_*.3%{ext_man} %{_libdir}/pkgconfig/libcares.pc +%{_libdir}/cmake/c-ares/ %changelog From 8c39f8b875bace4b397d50f64e0a23712a0ea5b1848f7b4b13bdb5fdb2529711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 4 Feb 2020 11:49:24 +0000 Subject: [PATCH 2/2] Accepting request 769948 from home:adamm:node_test - Upgrade to latest snapshot from 2020-01-17 - disable-live-tests.patch: refreshed - regression.patch: fix a regression in DNS results that contain both A and AAAA answers. - Add netcfg as the build requirement and runtime requirement. ares_getaddrinfo function uses the getservbyport_r function which requires the /etc/services file to function properly. That config file is provided by the netcfg package. Unit tests rely on it too, hence it has to be a build dependency as well. OBS-URL: https://build.opensuse.org/request/show/769948 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/c-ares?expand=0&rev=16 --- c-ares-1.15.0-20191108.tar.gz | 3 - c-ares-1.15.0-20200117.tar.gz | 3 + c-ares.changes | 17 ++++++ c-ares.spec | 11 +++- disable-live-tests.patch | 15 +++-- regression.patch | 106 ++++++++++++++++++++++++++++++++++ 6 files changed, 141 insertions(+), 14 deletions(-) delete mode 100644 c-ares-1.15.0-20191108.tar.gz create mode 100644 c-ares-1.15.0-20200117.tar.gz create mode 100644 regression.patch diff --git a/c-ares-1.15.0-20191108.tar.gz b/c-ares-1.15.0-20191108.tar.gz deleted file mode 100644 index 4ac84db..0000000 --- a/c-ares-1.15.0-20191108.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:327ca0ac334f8bcdc8d9da0cbc5e0ff2e304c248aab6cac8835936b1e3548a86 -size 1362964 diff --git a/c-ares-1.15.0-20200117.tar.gz b/c-ares-1.15.0-20200117.tar.gz new file mode 100644 index 0000000..516d29b --- /dev/null +++ b/c-ares-1.15.0-20200117.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86a99c9750698356ffde22cb42e2a18bb4c2baf424d31ba988c4e6f6fc18ba89 +size 1332073 diff --git a/c-ares.changes b/c-ares.changes index 383368c..44e3437 100644 --- a/c-ares.changes +++ b/c-ares.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +Mon Feb 3 15:17:24 UTC 2020 - Adam Majer + +- Upgrade to latest snapshot from 2020-01-17 +- disable-live-tests.patch: refreshed +- regression.patch: fix a regression in DNS results that contain + both A and AAAA answers. + +------------------------------------------------------------------- +Tue Jan 28 15:52:23 UTC 2020 - Michał Rostecki + +- Add netcfg as the build requirement and runtime requirement. + ares_getaddrinfo function uses the getservbyport_r function which + requires the /etc/services file to function properly. That config + file is provided by the netcfg package. Unit tests rely on it + too, hence it has to be a build dependency as well. + ------------------------------------------------------------------- Mon Jan 6 17:54:05 UTC 2020 - Todd R diff --git a/c-ares.spec b/c-ares.spec index b88cf5d..2e89537 100644 --- a/c-ares.spec +++ b/c-ares.spec @@ -1,7 +1,7 @@ # # spec file for package c-ares # -# Copyright (c) 2020 SUSE LLC. +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,9 +18,9 @@ %define sonum 2 %define libname libcares%{sonum} -%define realver 1.15.0-20191108 +%define realver 1.15.0-20200117 Name: c-ares -Version: 1.15.0+20191108 +Version: 1.15.0+20200117 Release: 0 Summary: Library for asynchronous name resolves License: MIT @@ -33,9 +33,12 @@ Source3: %{name}.keyring Source4: baselibs.conf Patch0: 0001-Use-RPM-compiler-options.patch Patch1: disable-live-tests.patch +Patch2: regression.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: libtool +# Needed for getservbyport_r function to work properly. +BuildRequires: netcfg BuildRequires: pkgconfig %description @@ -56,6 +59,8 @@ This package provides some tools that make use of c-ares. %package -n %{libname} Summary: Library for asynchronous name resolves +# Needed for getservbyport_r function to work properly. +Requires: netcfg %description -n %{libname} c-ares is a C library that performs DNS requests and name resolves diff --git a/disable-live-tests.patch b/disable-live-tests.patch index 1796a62..cb4e17b 100644 --- a/disable-live-tests.patch +++ b/disable-live-tests.patch @@ -1,20 +1,19 @@ -Index: c-ares-1.15.0-20191108/test/Makefile.inc +Index: c-ares-1.15.0-20200117/test/Makefile.inc =================================================================== ---- c-ares-1.15.0-20191108.orig/test/Makefile.inc -+++ c-ares-1.15.0-20191108/test/Makefile.inc -@@ -13,8 +13,6 @@ TESTSOURCES = ares-test-main.cc \ +--- c-ares-1.15.0-20200117.orig/test/Makefile.inc ++++ c-ares-1.15.0-20200117/test/Makefile.inc +@@ -13,7 +13,6 @@ TESTSOURCES = ares-test-main.cc \ ares-test-parse-srv.cc \ ares-test-parse-txt.cc \ ares-test-misc.cc \ - ares-test-live.cc \ -- ares-test-live-ai.cc \ ares-test-mock.cc \ ares-test-mock-ai.cc \ ares-test-internal.cc \ -Index: c-ares-1.15.0-20191108/test/ares-test-misc.cc +Index: c-ares-1.15.0-20200117/test/ares-test-misc.cc =================================================================== ---- c-ares-1.15.0-20191108.orig/test/ares-test-misc.cc -+++ c-ares-1.15.0-20191108/test/ares-test-misc.cc +--- c-ares-1.15.0-20200117.orig/test/ares-test-misc.cc ++++ c-ares-1.15.0-20200117/test/ares-test-misc.cc @@ -47,10 +47,12 @@ TEST_F(DefaultChannelTest, SetServers) { EXPECT_EQ(expected, GetNameServers(channel_)); diff --git a/regression.patch b/regression.patch new file mode 100644 index 0000000..46765e3 --- /dev/null +++ b/regression.patch @@ -0,0 +1,106 @@ +commit 9413d54ff43d18cedf0d4531408aabc7c2c102a2 +Author: Adam Majer +Date: Mon Feb 3 15:19:08 2020 +0100 + + Only count valid addresses when response parsing + + When ares_parse_a_reply or ares_parse_aaaa_reply is called in case + where another AAAA and A responses exist, the resulting ares_addrttl + count is invalid and the structure points to gibberish. + + This is a regression since 1.15. + + PR: https://github.com/c-ares/c-ares/pull/302 + +diff --git a/ares_parse_a_reply.c b/ares_parse_a_reply.c +index b506f72..920ba24 100644 +--- a/ares_parse_a_reply.c ++++ b/ares_parse_a_reply.c +@@ -86,7 +86,10 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, + next = ai.nodes; + while (next) + { +- ++naddrs; ++ if (next->ai_family == AF_INET) ++ { ++ ++naddrs; ++ } + next = next->ai_next; + } + +diff --git a/ares_parse_aaaa_reply.c b/ares_parse_aaaa_reply.c +index aca3f00..d39e138 100644 +--- a/ares_parse_aaaa_reply.c ++++ b/ares_parse_aaaa_reply.c +@@ -88,7 +88,10 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, + next = ai.nodes; + while (next) + { +- ++naddrs; ++ if(next->ai_family == AF_INET6) ++ { ++ ++naddrs; ++ } + next = next->ai_next; + } + +diff --git a/test/ares-test-parse-a.cc b/test/ares-test-parse-a.cc +index 77d9591..0741c0d 100644 +--- a/test/ares-test-parse-a.cc ++++ b/test/ares-test-parse-a.cc +@@ -11,13 +11,14 @@ TEST_F(LibraryTest, ParseAReplyOK) { + DNSPacket pkt; + pkt.set_qid(0x1234).set_response().set_aa() + .add_question(new DNSQuestion("example.com", ns_t_a)) +- .add_answer(new DNSARR("example.com", 0x01020304, {2,3,4,5})); ++ .add_answer(new DNSARR("example.com", 0x01020304, {2,3,4,5})) ++ .add_answer(new DNSAaaaRR("example.com", 0x01020304, {0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,5})); + std::vector data = { + 0x12, 0x34, // qid + 0x84, // response + query + AA + not-TC + not-RD + 0x00, // not-RA + not-Z + not-AD + not-CD + rc=NoError + 0x00, 0x01, // num questions +- 0x00, 0x01, // num answer RRs ++ 0x00, 0x02, // num answer RRs + 0x00, 0x00, // num authority RRs + 0x00, 0x00, // num additional RRs + // Question +@@ -35,6 +36,15 @@ TEST_F(LibraryTest, ParseAReplyOK) { + 0x01, 0x02, 0x03, 0x04, // TTL + 0x00, 0x04, // rdata length + 0x02, 0x03, 0x04, 0x05, ++ // Answer 2 ++ 0x07, 'e', 'x', 'a', 'm', 'p', 'l', 'e', ++ 0x03, 'c', 'o', 'm', ++ 0x00, ++ 0x00, 0x1c, // RR type ++ 0x00, 0x01, // class IN ++ 0x01, 0x02, 0x03, 0x04, // TTL ++ 0x00, 0x10, // rdata length ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x04, 0x05, + }; + EXPECT_EQ(data, pkt.data()); + struct hostent *host = nullptr; +@@ -68,7 +78,7 @@ TEST_F(LibraryTest, ParseMalformedAReply) { + 0x84, // [2] response + query + AA + not-TC + not-RD + 0x00, // [3] not-RA + not-Z + not-AD + not-CD + rc=NoError + 0x00, 0x01, // [4:6) num questions +- 0x00, 0x01, // [6:8) num answer RRs ++ 0x00, 0x02, // [6:8) num answer RRs + 0x00, 0x00, // [8:10) num authority RRs + 0x00, 0x00, // [10:12) num additional RRs + // Question +diff --git a/test/ares-test-parse-aaaa.cc b/test/ares-test-parse-aaaa.cc +index 9d0457e..1314c83 100644 +--- a/test/ares-test-parse-aaaa.cc ++++ b/test/ares-test-parse-aaaa.cc +@@ -13,7 +13,8 @@ TEST_F(LibraryTest, ParseAaaaReplyOK) { + .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_answer(new DNSAaaaRR("example.com", 100, + {0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, +- 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04})); ++ 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04})) ++ .add_answer(new DNSARR("example.com", 0x01020304, {2,3,4,5})); + std::vector data = pkt.data(); + struct hostent *host = nullptr; + struct ares_addr6ttl info[5];