public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH COMMITTED] resolv: Turn historic name lookup functions into compat symbols
@ 2016-12-30 19:16 Florian Weimer
  2017-02-16  0:38 ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Florian Weimer @ 2016-12-30 19:16 UTC (permalink / raw)
  To: libc-alpha

This change also removes the preprocessor-based function renaming.
It also applied to tests in resolv/, which ended up running against
the historic functions.

_endhtent was not part of the ABI because it is not listed in the
resolv/Versions file.

2016-12-30  Florian Weimer  <fweimer@redhat.com>

	* resolv/Makefile (libresolv-routines): Rename gethnamaddr to
	compat-gethnamaddr.
	(CPPFLAGS): Remove.
	* resolv/gethnamaddr.c: Rename ...
	* resolv/compat-gethnamaddr.c: ... to this file.
	(_endhtent): Make static.
	(res_gethostbyname): Renamed from gethostbyname.  Turn into compat
	symbol.
	(res_gethostbyname2): Renamed from gethostbyname2.  Turn into
	compat symbol.
	(res_gethostbyaddr): Renamed from gethostbyaddr.  Turn into compat
	symbol.
	(_sethtent, _gethtent, _gethtbyname, gethtbyname2, _gethtbyaddr):
	Turn into compat symbol.
	* include/resolv.h (_endhtent): Remove declaration.

diff --git a/include/resolv.h b/include/resolv.h
index 699cc81..95dcd3c 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -26,7 +26,6 @@ extern __thread struct __res_state *__resp attribute_tls_model_ie;
 extern int __res_vinit (res_state, int);
 extern int __res_maybe_init (res_state, int);
 extern void _sethtent (int);
-extern void _endhtent (void);
 extern struct hostent *_gethtent (void);
 extern struct hostent *_gethtbyname (const char *__name);
 extern struct hostent *_gethtbyname2 (const char *__name, int __af);
diff --git a/resolv/Makefile b/resolv/Makefile
index 06329e1..bd086e0 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -42,11 +42,12 @@ routines += gai_sigqueue
 tests += tst-res_hconf_reorder
 endif
 extra-libs-others = $(extra-libs)
-libresolv-routines := gethnamaddr res_comp res_debug	\
+libresolv-routines := res_comp res_debug \
 		      res_data res_mkquery res_query res_send		\
 		      inet_net_ntop inet_net_pton inet_neta base64	\
 		      ns_parse ns_name ns_netint ns_ttl ns_print	\
-		      ns_samedomain ns_date compat-hooks
+		      ns_samedomain ns_date \
+		      compat-hooks compat-gethnamaddr
 
 libanl-routines := gai_cancel gai_error gai_misc gai_notify gai_suspend \
 		   getaddrinfo_a
@@ -84,12 +85,6 @@ generated += mtrace-tst-leaks.out tst-leaks.mtrace \
 
 include ../Rules
 
-CPPFLAGS += -Dgethostbyname=res_gethostbyname \
-	    -Dgethostbyname2=res_gethostbyname2 \
-	    -Dgethostbyaddr=res_gethostbyaddr \
-	    -Dgetnetbyname=res_getnetbyname \
-	    -Dgetnetbyaddr=res_getnetbyaddr
-
 CFLAGS-res_hconf.c = -fexceptions
 
 # The DNS NSS modules needs the resolver.
diff --git a/resolv/gethnamaddr.c b/resolv/compat-gethnamaddr.c
similarity index 91%
rename from resolv/gethnamaddr.c
rename to resolv/compat-gethnamaddr.c
+++ b/resolv/compat-gethnamaddr.c
@@ -54,23 +54,26 @@
    it exports symbols in the libresolv ABI.  The file is not maintained any
    more, nor are these functions.  */
 
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_25)
 
-#include <stdio.h>
-#include <netdb.h>
-#include <resolv.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
+# include <sys/types.h>
+# include <sys/param.h>
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# include <arpa/nameser.h>
 
-#define	MAXALIASES	35
-#define	MAXADDRS	35
+# include <stdio.h>
+# include <netdb.h>
+# include <resolv.h>
+# include <ctype.h>
+# include <errno.h>
+# include <stdlib.h>
+# include <string.h>
+
+# define	MAXALIASES	35
+# define	MAXADDRS	35
 
 static char *h_addr_ptrs[MAXADDRS + 1];
 
@@ -86,17 +89,17 @@ static void map_v4v6_hostent (struct hostent *hp, char **bp, int *len) __THROW;
 
 extern void addrsort (char **, int) __THROW;
 
-#if PACKETSZ > 65536
-#define	MAXPACKET	PACKETSZ
-#else
-#define	MAXPACKET	65536
-#endif
+# if PACKETSZ > 65536
+#  define	MAXPACKET	PACKETSZ
+# else
+#  define	MAXPACKET	65536
+# endif
 
 /* As per RFC 1034 and 1035 a host name cannot exceed 255 octets in length.  */
-#ifdef MAXHOSTNAMELEN
-# undef MAXHOSTNAMELEN
-#endif
-#define MAXHOSTNAMELEN 256
+# ifdef MAXHOSTNAMELEN
+#  undef MAXHOSTNAMELEN
+# endif
+# define MAXHOSTNAMELEN 256
 
 typedef union {
     HEADER hdr;
@@ -108,11 +111,11 @@ typedef union {
     char ac;
 } align;
 
-#ifndef h_errno
+# ifndef h_errno
 extern int h_errno;
-#endif
+# endif
 
-#ifdef DEBUG
+# ifdef DEBUG
 static void
 Dprintf (char *msg, int num)
 {
@@ -123,11 +126,11 @@ Dprintf (char *msg, int num)
 		__set_errno (save);
 	}
 }
-#else
-# define Dprintf(msg, num) /*nada*/
-#endif
+# else
+#  define Dprintf(msg, num) /*nada*/
+# endif
 
-#define BOUNDED_INCR(x) \
+# define BOUNDED_INCR(x) \
 	do { \
 		cp += x; \
 		if (cp > eom) { \
@@ -136,7 +139,7 @@ Dprintf (char *msg, int num)
 		} \
 	} while (0)
 
-#define BOUNDS_CHECK(ptr, count) \
+# define BOUNDS_CHECK(ptr, count) \
 	do { \
 		if ((ptr) + (count) > eom) { \
 			__set_h_errno (NO_RECOVERY); \
@@ -419,11 +422,11 @@ getanswer (const querybuf *answer, int anslen, const char *qname, int qtype)
 	return (NULL);
 }
 
-extern struct hostent *gethostbyname2(const char *name, int af);
-libresolv_hidden_proto (gethostbyname2)
+extern struct hostent *res_gethostbyname2(const char *name, int af);
+libresolv_hidden_proto (res_gethostbyname2)
 
 struct hostent *
-gethostbyname (const char *name)
+res_gethostbyname (const char *name)
 {
 	struct hostent *hp;
 
@@ -432,15 +435,16 @@ gethostbyname (const char *name)
 		return (NULL);
 	}
 	if (_res.options & RES_USE_INET6) {
-		hp = gethostbyname2(name, AF_INET6);
+		hp = res_gethostbyname2(name, AF_INET6);
 		if (hp)
 			return (hp);
 	}
-	return (gethostbyname2(name, AF_INET));
+	return (res_gethostbyname2(name, AF_INET));
 }
+compat_symbol (libresolv, res_gethostbyname, res_gethostbyname, GLIBC_2_0);
 
 struct hostent *
-gethostbyname2 (const char *name, int af)
+res_gethostbyname2 (const char *name, int af)
 {
 	union
 	{
@@ -568,10 +572,11 @@ gethostbyname2 (const char *name, int af)
 		free (buf.buf);
 	return ret;
 }
-libresolv_hidden_def (gethostbyname2)
+libresolv_hidden_def (res_gethostbyname2)
+compat_symbol (libresolv, res_gethostbyname2, res_gethostbyname2, GLIBC_2_0);
 
 struct hostent *
-gethostbyaddr (const void *addr, socklen_t len, int af)
+res_gethostbyaddr (const void *addr, socklen_t len, int af)
 {
 	const u_char *uaddr = (const u_char *)addr;
 	static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
@@ -668,6 +673,7 @@ gethostbyaddr (const void *addr, socklen_t len, int af)
 	__set_h_errno (NETDB_SUCCESS);
 	return (hp);
 }
+compat_symbol (libresolv, res_gethostbyaddr, res_gethostbyaddr, GLIBC_2_0);
 
 void
 _sethtent (int f)
@@ -679,8 +685,9 @@ _sethtent (int f)
 	stayopen = f;
 }
 libresolv_hidden_def (_sethtent)
+compat_symbol (libresolv, _sethtent, _sethtent, GLIBC_2_0);
 
-void
+static void
 _endhtent (void)
 {
 	if (hostf && !stayopen) {
@@ -754,6 +761,7 @@ _gethtent (void)
 	return (&host);
 }
 libresolv_hidden_def (_gethtent)
+compat_symbol (libresolv, _gethtent, _gethtent, GLIBC_2_0);
 
 struct hostent *
 _gethtbyname (const char *name)
@@ -767,6 +775,7 @@ _gethtbyname (const char *name)
 	}
 	return (_gethtbyname2(name, AF_INET));
 }
+compat_symbol (libresolv, _gethtbyname, _gethtbyname, GLIBC_2_0);
 
 struct hostent *
 _gethtbyname2 (const char *name, int af)
@@ -789,6 +798,7 @@ _gethtbyname2 (const char *name, int af)
 	return (p);
 }
 libresolv_hidden_def (_gethtbyname2)
+compat_symbol (libresolv, _gethtbyname2, _gethtbyname2, GLIBC_2_0);
 
 struct hostent *
 _gethtbyaddr (const char *addr, size_t len, int af)
@@ -803,6 +813,7 @@ _gethtbyaddr (const char *addr, size_t len, int af)
 	return (p);
 }
 libresolv_hidden_def (_gethtbyaddr)
+compat_symbol (libresolv, _gethtbyaddr, _gethtbyaddr, GLIBC_2_0);
 
 static void
 map_v4v6_address (const char *src, char *dst)
@@ -888,3 +899,5 @@ addrsort (char **ap, int num)
 	    needsort++;
 	}
 }
+
+#endif	/* SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_25) */

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

* Re: [PATCH COMMITTED] resolv: Turn historic name lookup functions into compat symbols
  2016-12-30 19:16 [PATCH COMMITTED] resolv: Turn historic name lookup functions into compat symbols Florian Weimer
@ 2017-02-16  0:38 ` Andreas Schwab
  2017-02-16  7:43   ` Florian Weimer
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2017-02-16  0:38 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

On Dez 30 2016, fweimer@redhat.com (Florian Weimer) wrote:

> This change also removes the preprocessor-based function renaming.
> It also applied to tests in resolv/, which ended up running against
> the historic functions.

This is missing a NEWS entry.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH COMMITTED] resolv: Turn historic name lookup functions into compat symbols
  2017-02-16  0:38 ` Andreas Schwab
@ 2017-02-16  7:43   ` Florian Weimer
  2017-02-16  9:18     ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Florian Weimer @ 2017-02-16  7:43 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha

On 02/16/2017 01:38 AM, Andreas Schwab wrote:
> On Dez 30 2016, fweimer@redhat.com (Florian Weimer) wrote:
>
>> This change also removes the preprocessor-based function renaming.
>> It also applied to tests in resolv/, which ended up running against
>> the historic functions.
>
> This is missing a NEWS entry.

How so?  I truly wasn't aware that the change is user-visible.

Or put differently, I don't think we need NEWS entries if we turn 
symbols which are not mentioned in any header file into compat symbols 
because there is no supported ways programs can link to these symbols.

Thanks,
Florian

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

* Re: [PATCH COMMITTED] resolv: Turn historic name lookup functions into compat symbols
  2017-02-16  7:43   ` Florian Weimer
@ 2017-02-16  9:18     ` Andreas Schwab
  2017-02-16 12:32       ` Florian Weimer
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2017-02-16  9:18 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

On Feb 16 2017, Florian Weimer <fweimer@redhat.com> wrote:

> On 02/16/2017 01:38 AM, Andreas Schwab wrote:
>> On Dez 30 2016, fweimer@redhat.com (Florian Weimer) wrote:
>>
>>> This change also removes the preprocessor-based function renaming.
>>> It also applied to tests in resolv/, which ended up running against
>>> the historic functions.
>>
>> This is missing a NEWS entry.
>
> How so?  I truly wasn't aware that the change is user-visible.

ekiga fails to build.

https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:B:DVD/ekiga/standard/x86_64

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH COMMITTED] resolv: Turn historic name lookup functions into compat symbols
  2017-02-16  9:18     ` Andreas Schwab
@ 2017-02-16 12:32       ` Florian Weimer
  2017-02-16 16:56         ` Carlos O'Donell
  0 siblings, 1 reply; 7+ messages in thread
From: Florian Weimer @ 2017-02-16 12:32 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha

* Andreas Schwab:

> On Feb 16 2017, Florian Weimer <fweimer@redhat.com> wrote:
>
>> On 02/16/2017 01:38 AM, Andreas Schwab wrote:
>>> On Dez 30 2016, fweimer@redhat.com (Florian Weimer) wrote:
>>>
>>>> This change also removes the preprocessor-based function renaming.
>>>> It also applied to tests in resolv/, which ended up running against
>>>> the historic functions.
>>>
>>> This is missing a NEWS entry.
>>
>> How so?  I truly wasn't aware that the change is user-visible.
>
> ekiga fails to build.
>
> https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:B:DVD/ekiga/standard/x86_64

This seems to be a bogus configure check, probably a leftover from the
libc5 days.  I don't the source code references to the
res_gethostbyaddr function itself.

ypbind is another candidate for problems, but it's intimately tied to
glibc anyway and is thus a special case.

I still don't think this warrants a NEWS entry.

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

* Re: [PATCH COMMITTED] resolv: Turn historic name lookup functions into compat symbols
  2017-02-16 12:32       ` Florian Weimer
@ 2017-02-16 16:56         ` Carlos O'Donell
  2017-02-17  7:57           ` Florian Weimer
  0 siblings, 1 reply; 7+ messages in thread
From: Carlos O'Donell @ 2017-02-16 16:56 UTC (permalink / raw)
  To: Florian Weimer, Andreas Schwab; +Cc: libc-alpha

On 02/16/2017 07:32 AM, Florian Weimer wrote:
> * Andreas Schwab:
> 
>> On Feb 16 2017, Florian Weimer <fweimer@redhat.com> wrote:
>>
>>> On 02/16/2017 01:38 AM, Andreas Schwab wrote:
>>>> On Dez 30 2016, fweimer@redhat.com (Florian Weimer) wrote:
>>>>
>>>>> This change also removes the preprocessor-based function renaming.
>>>>> It also applied to tests in resolv/, which ended up running against
>>>>> the historic functions.
>>>>
>>>> This is missing a NEWS entry.
>>>
>>> How so?  I truly wasn't aware that the change is user-visible.
>>
>> ekiga fails to build.
>>
>> https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:B:DVD/ekiga/standard/x86_64
> 
> This seems to be a bogus configure check, probably a leftover from the
> libc5 days.  I don't the source code references to the
> res_gethostbyaddr function itself.
> 
> ypbind is another candidate for problems, but it's intimately tied to
> glibc anyway and is thus a special case.
> 
> I still don't think this warrants a NEWS entry.
 
I agree, but it does need a distribution note in the 2.26 release wiki.
https://sourceware.org/glibc/wiki/Release/2.26#Packaging_Changes


-- 
Cheers,
Carlos.

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

* Re: [PATCH COMMITTED] resolv: Turn historic name lookup functions into compat symbols
  2017-02-16 16:56         ` Carlos O'Donell
@ 2017-02-17  7:57           ` Florian Weimer
  0 siblings, 0 replies; 7+ messages in thread
From: Florian Weimer @ 2017-02-17  7:57 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: Andreas Schwab, libc-alpha

* Carlos O'Donell:

> On 02/16/2017 07:32 AM, Florian Weimer wrote:
>> * Andreas Schwab:
>> 
>>> On Feb 16 2017, Florian Weimer <fweimer@redhat.com> wrote:
>>>
>>>> On 02/16/2017 01:38 AM, Andreas Schwab wrote:
>>>>> On Dez 30 2016, fweimer@redhat.com (Florian Weimer) wrote:
>>>>>
>>>>>> This change also removes the preprocessor-based function renaming.
>>>>>> It also applied to tests in resolv/, which ended up running against
>>>>>> the historic functions.
>>>>>
>>>>> This is missing a NEWS entry.
>>>>
>>>> How so?  I truly wasn't aware that the change is user-visible.
>>>
>>> ekiga fails to build.
>>>
>>> https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:B:DVD/ekiga/standard/x86_64
>> 
>> This seems to be a bogus configure check, probably a leftover from the
>> libc5 days.  I don't the source code references to the
>> res_gethostbyaddr function itself.
>> 
>> ypbind is another candidate for problems, but it's intimately tied to
>> glibc anyway and is thus a special case.
>> 
>> I still don't think this warrants a NEWS entry.
>  
> I agree, but it does need a distribution note in the 2.26 release wiki.
> https://sourceware.org/glibc/wiki/Release/2.26#Packaging_Changes

Right, I added something to the end of:

  https://sourceware.org/glibc/wiki/Release/2.25

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

end of thread, other threads:[~2017-02-17  7:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-30 19:16 [PATCH COMMITTED] resolv: Turn historic name lookup functions into compat symbols Florian Weimer
2017-02-16  0:38 ` Andreas Schwab
2017-02-16  7:43   ` Florian Weimer
2017-02-16  9:18     ` Andreas Schwab
2017-02-16 12:32       ` Florian Weimer
2017-02-16 16:56         ` Carlos O'Donell
2017-02-17  7:57           ` Florian Weimer

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).