public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [BZ 24816] Fix nss/tst-nss-files-hosts-long.c when there is no IPv6 support
@ 2019-07-17 17:57 Romain Geissler
  2019-07-18 11:48 ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Romain Geissler @ 2019-07-17 17:57 UTC (permalink / raw)
  To: libc-alpha

Hi,

Here is a small patch to fix BZ 24816 (details are in the bug report).

Tested on Linux x64.

PS: I don't have a copyright assignment, and the diff while trivial, is bigger than 15 lines. Is this still ok or not ?

Cheers,
Romain


2019-07-17  Romain Geissler  <romain.geissler@amadeus.com>

	[BZ #24816]
	* nss/tst-nss-files-hosts-long.c: Include <ifaddrs.h>.
	(supports_inet_family): Define.
	(do_test): Use supports_inet_family for AF_INET and AF_INET6.


From 5c57c2ead3684a26924a87b8f2dd43b75470ab9b Mon Sep 17 00:00:00 2001
From: Romain Geissler <romain.geissler@amadeus.com>
Date: Wed, 17 Jul 2019 12:29:21 +0000
Subject: [PATCH] [BZ 24816] Fix nss/tst-nss-files-hosts-long.c when there is
 no IPv6 support.

---
 nss/tst-nss-files-hosts-long.c | 47 ++++++++++++++++++++++++++++------
 1 file changed, 39 insertions(+), 8 deletions(-)

diff --git a/nss/tst-nss-files-hosts-long.c b/nss/tst-nss-files-hosts-long.c
index 32f849e481b..aa79b88e41a 100644
--- a/nss/tst-nss-files-hosts-long.c
+++ b/nss/tst-nss-files-hosts-long.c
@@ -22,6 +22,31 @@
 #include <stdlib.h>
 #include <nss.h>
 #include <support/check.h>
+#include <ifaddrs.h>
+
+static int
+supports_inet_family(int family)
+{
+  struct ifaddrs *ifaddr, *ifa;
+  int ret = 0;
+
+  if (getifaddrs(&ifaddr) == -1)
+    FAIL_EXIT1("getifaddrs failed");
+
+  for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
+    if (ifa->ifa_addr == NULL)
+      continue;
+
+    if (ifa->ifa_addr->sa_family == family) {
+      ret = 1;
+      break;
+    }
+  }
+
+  freeifaddrs(ifaddr);
+
+  return ret;
+}

 static int
 do_test (void)
@@ -30,14 +55,20 @@ do_test (void)

   /* Run getent to fetch the IPv4 address for host test4.
      This forces /etc/hosts to be parsed.  */
-  ret = system("getent ahostsv4 test4");
-  if (ret != 0)
-    FAIL_EXIT1("ahostsv4 failed");
-
-  /* Likewise for IPv6.  */
-  ret = system("getent ahostsv6 test6");
-  if (ret != 0)
-    FAIL_EXIT1("ahostsv6 failed");
+  if (supports_inet_family(AF_INET))
+  {
+    ret = system("getent ahostsv4 test4");
+    if (ret != 0)
+      FAIL_EXIT1("ahostsv4 failed");
+  }
+
+    /* Likewise for IPv6.  */
+  if (supports_inet_family(AF_INET6))
+  {
+    ret = system("getent ahostsv6 test6");
+    if (ret != 0)
+      FAIL_EXIT1("ahostsv6 failed");
+  }

   exit (0);
 }
-- 
2.17.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BZ 24816] Fix nss/tst-nss-files-hosts-long.c when there is no IPv6 support
  2019-07-17 17:57 [BZ 24816] Fix nss/tst-nss-files-hosts-long.c when there is no IPv6 support Romain Geissler
@ 2019-07-18 11:48 ` Florian Weimer
  2019-07-18 12:18   ` Romain Geissler
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2019-07-18 11:48 UTC (permalink / raw)
  To: Romain Geissler; +Cc: libc-alpha

* Romain Geissler:

> PS: I don't have a copyright assignment, and the diff while trivial,
> is bigger than 15 lines. Is this still ok or not ?

Do you plan to contribute more in the future?  Then the FSF will need a
copyright assignment from your employer (or one from you and a copyright
disclaimer from your employer).

You can start the process by sending this form to <assign@gnu.org>:

<http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future>

These days, the process is pretty lightweight (unless changes to the
contract are needed).

Thanks,
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BZ 24816] Fix nss/tst-nss-files-hosts-long.c when there is no IPv6 support
  2019-07-18 11:48 ` Florian Weimer
@ 2019-07-18 12:18   ` Romain Geissler
  2019-07-18 18:28     ` Carlos O'Donell
  0 siblings, 1 reply; 4+ messages in thread
From: Romain Geissler @ 2019-07-18 12:18 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Romain Geissler, libc-alpha

On Thu, 18 Jul 2019, Florian Weimer wrote:

> * Romain Geissler:
>
> > PS: I don't have a copyright assignment, and the diff while trivial,
> > is bigger than 15 lines. Is this still ok or not ?
>
> Do you plan to contribute more in the future?  Then the FSF will need a
> copyright assignment from your employer (or one from you and a copyright
> disclaimer from your employer).
>
> You can start the process by sending this form to <assign@gnu.org>:
>
> <https://clicktime.symantec.com/3WTbPcwnFmA9W7V3gxYdCWE6H2?u=http%3A%2F%2Fgit.savannah.gnu.org%2Fcgit%2Fgnulib.git%2Fplain%2Fdoc%2FCopyright%2Frequest-assign.future>
>
> These days, the process is pretty lightweight (unless changes to the
> contract are needed).
>

Hi,

I have no foreseeable plans to contribute more. So far my contributions
have always been totally small and trivial (basically, making the GNU
toolchain component build and their corresponding test suite work
internally in Amadeus).

I haven't understood all the details, but discussions between layers
from FSF and Amadeus did happen earlier this year, and no so far we
haven't signed anything. However I was told from the Amadeus layers that
it's not over for contributions, we can have case by case specific
agreement that would suit both Amadeus and the FSF. Do you consider this
patch goes beyond the notion of "trivial" and requires me to start the
procedure on my side to get everything legally set up correctly ?

Cheers,
Romain

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BZ 24816] Fix nss/tst-nss-files-hosts-long.c when there is no IPv6 support
  2019-07-18 12:18   ` Romain Geissler
@ 2019-07-18 18:28     ` Carlos O'Donell
  0 siblings, 0 replies; 4+ messages in thread
From: Carlos O'Donell @ 2019-07-18 18:28 UTC (permalink / raw)
  To: Romain Geissler, Florian Weimer; +Cc: libc-alpha

On 7/18/19 8:18 AM, Romain Geissler wrote:
> I have no foreseeable plans to contribute more. So far my contributions
> have always been totally small and trivial (basically, making the GNU
> toolchain component build and their corresponding test suite work
> internally in Amadeus).
> 
> I haven't understood all the details, but discussions between layers
> from FSF and Amadeus did happen earlier this year, and no so far we
> haven't signed anything. However I was told from the Amadeus layers that
> it's not over for contributions, we can have case by case specific
> agreement that would suit both Amadeus and the FSF. Do you consider this
> patch goes beyond the notion of "trivial" and requires me to start the
> procedure on my side to get everything legally set up correctly ?

Romain,

I would love nothing more than to just be able to accept patches from
you without any hassle :-)

The most straight forward way to do this is to kick off another discussion
with Amadenus and the FSF.

You start by filling out this form:
http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future

You would list that Amadeus has claims to your changes, and then the
FSF lawyers and Amadeus lawyers may need to talk.

Please tell me if I can help.

-- 
Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-18 18:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17 17:57 [BZ 24816] Fix nss/tst-nss-files-hosts-long.c when there is no IPv6 support Romain Geissler
2019-07-18 11:48 ` Florian Weimer
2019-07-18 12:18   ` Romain Geissler
2019-07-18 18:28     ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).