public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/538] New: Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib
@ 2004-11-10 18:42 simon@josefsson.org
  2004-12-03  1:50 ` [Bug libc/538] " gotom at debian dot or dot jp
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: simon@josefsson.org @ 2004-11-10 18:42 UTC (permalink / raw)
  To: glibc-bugs

Gnulib contain a getaddrinfo.c re-implementation.  While the core implementation
is not the same as the one in libc (the glibc one is not GPL), I'd like for
gai_strerror.c to be shared.  What do you think of the following patch?

(Btw, the anonymous CVS pserver seem down at the moment.)

Thanks.

2004-11-10  Simon Josefsson  <jas@extundo.com>

	* sysdeps/posix/gai_strerror.c [_LIBC]: Make #include <libintl.h>
	conditional on _LIBC.
	[!_LIBC]: Include getaddrinfo.h, gettext.h and define _ and N_,
	for when the file is used in gnulib.
	[__USE_GNU]: Only use EAI_INPROGRESS, EAI_CANCELED,
	EAI_NOTCANCELED, EAI_ALLDONE, EAI_INTR, and EAI_IDN_ENCODE when
	__USE_GNU, to align with netdb.h.
	[_LIBC]: Make libc_hidden_def conditional on _LIBC.

--- gai_strerror.c.orig	2004-11-10 19:36:32.000000000 +0100
+++ gai_strerror.c	2004-11-10 19:30:29.000000000 +0100
@@ -19,7 +19,15 @@
 
 #include <stdio.h>
 #include <netdb.h>
-#include <libintl.h>
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "getaddrinfo.h"
+# include "gettext.h"
+# define _(String) gettext (String)
+# define N_(String) String
+#endif
 
 static struct
   {
@@ -39,12 +47,14 @@
     { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
     { EAI_SOCKTYPE, N_("ai_socktype not supported") },
     { EAI_SYSTEM, N_("System error") },
+#ifdef __USE_GNU
     { EAI_INPROGRESS, N_("Processing request in progress") },
     { EAI_CANCELED, N_("Request canceled") },
     { EAI_NOTCANCELED, N_("Request not canceled") },
     { EAI_ALLDONE, N_("All requests done") },
     { EAI_INTR, N_("Interrupted by a signal") },
     { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
+#endif
   };
 
 const char *
@@ -57,4 +67,6 @@
 
   return _("Unknown error");
 }
+#ifdef _LIBC
 libc_hidden_def (gai_strerror)
+#endif

-- 
           Summary: Improvement to getaddrinfo gai_strerror.c to make it
                    usable in gnulib
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: simon at josefsson dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sources.redhat.com/bugzilla/show_bug.cgi?id=538

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/538] Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib
  2004-11-10 18:42 [Bug libc/538] New: Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib simon@josefsson.org
@ 2004-12-03  1:50 ` gotom at debian dot or dot jp
  2005-09-23  0:53 ` drepper at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gotom at debian dot or dot jp @ 2004-12-03  1:50 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From gotom at debian dot or dot jp  2004-12-03 01:50 -------
Ulrich, I hope you judge this report.



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|gotom at debian dot or dot  |drepper at redhat dot com
                   |jp                          |
             Status|NEW                         |ASSIGNED


http://sources.redhat.com/bugzilla/show_bug.cgi?id=538

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/538] Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib
  2004-11-10 18:42 [Bug libc/538] New: Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib simon@josefsson.org
  2004-12-03  1:50 ` [Bug libc/538] " gotom at debian dot or dot jp
@ 2005-09-23  0:53 ` drepper at redhat dot com
  2005-09-23 13:44 ` simon at josefsson dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: drepper at redhat dot com @ 2005-09-23  0:53 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2005-09-23 00:53 -------
It is always wrong to use __USE_GNU in non-header files.  The file must simply
be defined so that the definitions of the values are visible in the header.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING


http://sourceware.org/bugzilla/show_bug.cgi?id=538

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/538] Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib
  2004-11-10 18:42 [Bug libc/538] New: Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib simon@josefsson.org
  2004-12-03  1:50 ` [Bug libc/538] " gotom at debian dot or dot jp
  2005-09-23  0:53 ` drepper at redhat dot com
@ 2005-09-23 13:44 ` simon at josefsson dot org
  2005-09-23 13:47 ` simon at josefsson dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: simon at josefsson dot org @ 2005-09-23 13:44 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From simon at josefsson dot org  2005-09-23 13:43 -------
(In reply to comment #2)
> It is always wrong to use __USE_GNU in non-header files.  The file must simply
> be defined so that the definitions of the values are visible in the header.

How about this patch?  It sync with current gnulib CVS, and hide the non-POSIX
EAI_* values inside a #if EAI_IDN_ENCODE test.

Index: gai_strerror.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/posix/gai_strerror.c,v
retrieving revision 1.7
diff -u -p -r1.7 gai_strerror.c
--- gai_strerror.c      8 Mar 2004 22:21:13 -0000       1.7
+++ gai_strerror.c      23 Sep 2005 13:41:31 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.

@@ -17,9 +17,24 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */

+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifndef _LIBC
+# include "getaddrinfo.h"
+#endif
+
 #include <stdio.h>
 #include <netdb.h>
-#include <libintl.h>
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "gettext.h"
+# define _(String) gettext (String)
+# define N_(String) String
+#endif

 static struct
   {
@@ -39,12 +54,14 @@ values[] =
     { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
     { EAI_SOCKTYPE, N_("ai_socktype not supported") },
     { EAI_SYSTEM, N_("System error") },
+#ifdef EAI_IDN_ENCODE
     { EAI_INPROGRESS, N_("Processing request in progress") },
     { EAI_CANCELED, N_("Request canceled") },
     { EAI_NOTCANCELED, N_("Request not canceled") },
     { EAI_ALLDONE, N_("All requests done") },
     { EAI_INTR, N_("Interrupted by a signal") },
     { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
+#endif
   };

 const char *
@@ -57,4 +74,6 @@ gai_strerror (int code)

   return _("Unknown error");
 }
+#ifdef _LIBC
 libc_hidden_def (gai_strerror)
+#endif

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=538

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/538] Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib
  2004-11-10 18:42 [Bug libc/538] New: Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib simon@josefsson.org
                   ` (2 preceding siblings ...)
  2005-09-23 13:44 ` simon at josefsson dot org
@ 2005-09-23 13:47 ` simon at josefsson dot org
  2005-10-15  5:16 ` drepper at redhat dot com
  2006-04-25 18:13 ` drepper at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: simon at josefsson dot org @ 2005-09-23 13:47 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From simon at josefsson dot org  2005-09-23 13:46 -------
(In reply to comment #3)
> (In reply to comment #2)
> > It is always wrong to use __USE_GNU in non-header files.  The file must simply
> > be defined so that the definitions of the values are visible in the header.
> 
> How about this patch?  It sync with current gnulib CVS, and hide the non-POSIX
> EAI_* values inside a #if EAI_IDN_ENCODE test.

Updated changelog entry:

2005-09-23  Simon Josefsson  <jas@extundo.com>

	* sysdeps/posix/gai_strerror.c [_LIBC]: Make #include <libintl.h>
	conditional on _LIBC.
	[!_LIBC]: Include getaddrinfo.h, gettext.h and define _ and N_,
	for when the file is used in gnulib.
	[__EAI_IDN_ENCODE]: Only use EAI_INPROGRESS, EAI_CANCELED,
	EAI_NOTCANCELED, EAI_ALLDONE, EAI_INTR, and EAI_IDN_ENCODE when
	EAI_IDN_ENCODE is defined, to make the file work on non-GNU systems.
	[_LIBC]: Make libc_hidden_def conditional on _LIBC.
	[HAVE_CONFIG_H]: Include config.h, for gnulib.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=538

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/538] Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib
  2004-11-10 18:42 [Bug libc/538] New: Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib simon@josefsson.org
                   ` (3 preceding siblings ...)
  2005-09-23 13:47 ` simon at josefsson dot org
@ 2005-10-15  5:16 ` drepper at redhat dot com
  2006-04-25 18:13 ` drepper at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: drepper at redhat dot com @ 2005-10-15  5:16 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2005-10-15 05:16 -------
I really don't understand the motivation.  If your implementation even differs
in the errors provided, there is absolutely no reason to complicate the glibc
code just for sharing 4 lines of which likely will never change.  Just copy the
file, remove all glibc-ism, and be happy.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |drepper at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=538

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/538] Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib
  2004-11-10 18:42 [Bug libc/538] New: Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib simon@josefsson.org
                   ` (4 preceding siblings ...)
  2005-10-15  5:16 ` drepper at redhat dot com
@ 2006-04-25 18:13 ` drepper at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: drepper at redhat dot com @ 2006-04-25 18:13 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2006-04-25 18:13 -------
No reply in 6+ months.  Closing.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |WONTFIX


http://sourceware.org/bugzilla/show_bug.cgi?id=538

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2006-04-25 18:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-10 18:42 [Bug libc/538] New: Improvement to getaddrinfo gai_strerror.c to make it usable in gnulib simon@josefsson.org
2004-12-03  1:50 ` [Bug libc/538] " gotom at debian dot or dot jp
2005-09-23  0:53 ` drepper at redhat dot com
2005-09-23 13:44 ` simon at josefsson dot org
2005-09-23 13:47 ` simon at josefsson dot org
2005-10-15  5:16 ` drepper at redhat dot com
2006-04-25 18:13 ` drepper at redhat dot com

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