Re: new module 'fseterr'

2007-03-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> +  #error "Please port gnulib fseterr.c to your platform! Look at the 
> definitions of ferror and clearerr on your system, then report this to 
> bug-gnulib."

Thanks!  I forgot another reason to use this approach: it allows us to
discover more easily which platforms actually need a workaround.
Collecting such reports would be useful from a archaeological point of
view...

/Simon




Re: gnulib-tool: an autobuild facility

2007-03-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> Simon's http://autobuild.josefsson.org/gnulib/ summary page could be more
> useful (and larger :-)) if more people submit test results. To this
> effect, I'm adding a facility that produces an 'autobuild' script in
> "gnulib-tool --create-megatestdir".

Neat!  Using --create-megatestdir might be faster than what I'm
currently using too...  I'll switch to using your script on my host.

I really should improve the HTML output... here are some ideas:

1) Sort 'Failure' to the top, to make it easy to spot what fails.

2) Have one file for the summary, and the other stuff in other files.
The current index.html is too large right now.

So much to do, so little time..

/Simon




Re: mempcpy: needs restrict

2007-03-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> I'm applying this fix. Hope it's ok with you, Simon.

Yup, thanks!

/Simon




Re: gc-des: needs stdbool

2007-03-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> Hi Simon,
>
> The gc-des module contains the lib/des.h header, which include .
> So it should depend on 'stdbool'. Currently, it doesn't, and the compiler
> on Solaris 8 complains:
>
> cc -O -DHAVE_CONFIG_H -I. -I..  -g -c des.c
> "./des.h", line 28: cannot find include file: 
> "./des.h", line 51: undefined or not a type: bool

Oops, thanks!

/Simon




Re: inet_ntop and Solaris

2007-03-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> Should gnulib compile its own inet_ntop() in this situation?
> If yes, you need to add a '#define inet_ntop rpl_inet_ntop' to gnulib's
> arpa/inet.h. If no, the autoconf test should look whether inet_ntop is
> available in -lnsl, and make this additional library available in a variable,
> say, LIBINET.

IMHO, gnulib should use -lnsl here.

/Simon




Re: getaddrinfo: compilation error on OSF/1 5.1

2007-03-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> Hi Simon,
>
> On OSF/1 5.1, with cc as compiler, the getaddrinfo module fails to compile:
>
> cc: Warning: getaddrinfo.c, line 334: In this declaration, parameter 2 has a 
> different type than specified in an earlier declaration of this function. 
> (mismatparam)
> int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
> ^
> cc: Error: getaddrinfo.c, line 334: In this declaration, the type of 
> "getnameinfo" is not compatible with the type of a previous declaration of 
> "getnameinfo" at line number 290 in file /usr/include/netdb.h. (notcompat)
> int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
> ^
>
> The reason is that  declares the functions as follows:
>
>   int getaddrinfo(
>   const char *nodename,
>   const char *servname,
>   const struct addrinfo *hints,
>   struct addrinfo **res);
>
>   int getnameinfo(
>   const struct sockaddr *sa,
>   socklen_t salen,
>   char *node,
>   size_t *nodelen,
>   char *serv,
>   size_t servlen,
>   int flags);
>
> which is different from what getaddrinfo.c does.

One problem is that getaddrinfo.c use socklen_t for the strings, which
seems wrong.  But this is what
http://www.opengroup.org/onlinepubs/009695399/functions/getnameinfo.html
says!  Isn't that bad?  As far as I understand, socklen_t should be
used for 'struct sockaddr's?  It might be too late to change this now,
though...

One solution would be for getaddrinfo.m4 to check what the prototype
in the system header is, and have getaddrinfo.c use the same
prototype.  The problems are:

1) Should 'restrict' be used?
2) Use socklen_t or size_t.

So I suppose getaddrinfo.m4 should finally test whether:

1) The POSIX prototype:

#include 
#ifdef HAVE_SYS_SOCKET_H
#include 
#endif
#ifdef HAVE_NETDB_H
#include 
#endif
#ifdef HAVE_WS2TCPIP_H
#include 
#endif
extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
   char *restrict node, socklen_t nodelen,
   char *restrict service, socklen_t servicelen,
   int flags);

or

2) The OSF/1 approach:

#include 
#ifdef HAVE_SYS_SOCKET_H
#include 
#endif
#ifdef HAVE_NETDB_H
#include 
#endif
#ifdef HAVE_WS2TCPIP_H
#include 
#endif
extern int getnameinfo(const struct sockaddr *sa, socklen_t salen,
   char *node, size_t nodelen,
   char *service, size_t servicelen,
   int flags);

parses correctly, and then set some #define depending on which is
used, which getaddrinfo.c could use?

What do you think?  Is there no better alternative?

/Simon




Re: des: compilation error on MacOS X

2007-03-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> Hi Simon,
>
> On MacOS X 10.3.9 the 'gc-gnulib' (or 'gc-des') module fails to build:
>
> depbase=`echo gc-gnulib.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
> gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC 
> -DEXEEXT=\"\" -I. -I..  -I../intl -Wall  -g -O2 -MT gc-gnulib.o -MD -MP -MF 
> $depbase.Tpo -c -o gc-gnulib.o gc-gnulib.c &&\
> mv -f $depbase.Tpo $depbase.Po
> In file included from gc-gnulib.c:65:
> des.h:62: error: conflicting types for `des_setkey'
> /usr/include/unistd.h:196: error: previous declaration of `des_setkey'
> make[3]: *** [gc-gnulib.o] Error 1
>
> The declaration in /usr/include/unistd.h looks like this:
>
> int  des_setkey(const char *key);
>
> which is clearly different from the one in gnulib's des.h:
>
> extern void
> des_setkey (des_ctx *ctx, const char * key);

Gnulib's goal here isn't trying to be compatible with whatever
standard specified the MacOS X 'des_setkey'.  I suspect their
functions use global variables for the context, which isn't something
we should promote.

I changed the namespace to gl_des as below.

/Simon

Index: lib/des.c
===
RCS file: /sources/gnulib/gnulib/lib/des.c,v
retrieving revision 1.3
diff -u -p -r1.3 des.c
--- lib/des.c   29 Oct 2006 21:52:55 -  1.3
+++ lib/des.c   12 Mar 2007 11:37:57 -
@@ -1,5 +1,5 @@
 /* des.c --- DES and Triple-DES encryption/decryption Algorithm
- * Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006
+ * Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007
  *Free Software Foundation, Inc.
  *
  * This file is free software; you can redistribute it and/or modify
@@ -54,7 +54,7 @@
  * unsigned char plaintext[8];
  * unsigned char ciphertext[8];
  * unsigned char recoverd[8];
- * des_ctx context;
+ * gl_des_ctx context;
  *
  * // Fill 'key' and 'plaintext' with some data
  * 
@@ -77,20 +77,20 @@
  * unsigned char plaintext[8];
  * unsigned char ciphertext[8];
  * unsigned char recoverd[8];
- * tripledes_ctx context;
+ * gl_3des_ctx context;
  *
  * // If you would like to use two 64bit keys, fill 'key1' and'key2'
  * // then setup the encryption context:
- * tripledes_set2keys(&context, key1, key2);
+ * gl_3des_set2keys(&context, key1, key2);
  *
  * // To use three 64bit keys with Triple-DES use:
- * tripledes_set3keys(&context, key1, key2, key3);
+ * gl_3des_set3keys(&context, key1, key2, key3);
  *
  * // Encrypting plaintext with Triple-DES
- * tripledes_ecb_encrypt(&context, plaintext, ciphertext);
+ * gl_3des_ecb_encrypt(&context, plaintext, ciphertext);
  *
  * // Decrypting ciphertext to recover the plaintext with Triple-DES
- * tripledes_ecb_decrypt(&context, ciphertext, recoverd);
+ * gl_3des_ecb_decrypt(&context, ciphertext, recoverd);
  */
 
 
@@ -324,7 +324,7 @@ static const unsigned char weak_keys_chk
 };
 
 bool
-des_is_weak_key (const char * key)
+gl_des_is_weak_key (const char * key)
 {
   char work[8];
   int i, left, right, middle, cmp_result;
@@ -424,14 +424,6 @@ des_is_weak_key (const char * key)
 data[6] = (right >> 8) &0xff; data[7] = right &0xff;
 
 /*
- * Handy macros for encryption and decryption of data
- */
-#define des_ecb_encrypt(ctx, from, to)   des_ecb_crypt(ctx, from, to, 0)
-#define des_ecb_decrypt(ctx, from, to)   des_ecb_crypt(ctx, from, to, 1)
-#define tripledes_ecb_encrypt(ctx, from, to) tripledes_ecb_crypt(ctx,from,to,0)
-#define tripledes_ecb_decrypt(ctx, from, to) tripledes_ecb_crypt(ctx,from,to,1)
-
-/*
  * des_key_schedule():   Calculate 16 subkeys pairs (even/odd) for
  *   16 encryption rounds.
  *   To calculate subkeys for decryption the caller
@@ -530,7 +522,7 @@ des_key_schedule (const char * _rawkey, 
 }
 
 void
-des_setkey (des_ctx *ctx, const char * key)
+gl_des_setkey (gl_des_ctx *ctx, const char * key)
 {
   int i;
 
@@ -544,7 +536,7 @@ des_setkey (des_ctx *ctx, const char * k
 }
 
 bool
-des_makekey (des_ctx *ctx, const char * key, size_t keylen)
+gl_des_makekey (gl_des_ctx *ctx, const char * key, size_t keylen)
 {
   if (keylen != 8)
 return false;
@@ -555,7 +547,7 @@ des_makekey (des_ctx *ctx, const char * 
 }
 
 void
-des_ecb_crypt (des_ctx *ctx, const char * _from, char * _to, int mode)
+gl_des_ecb_crypt (gl_des_ctx *ctx, const char * _from, char * _to, int mode)
 {
   const unsigned char *from = (const unsigned char *) _from;
   unsigned char *to = (unsigned char *) _to;
@@ -579,7 +571,7 @@ des_ecb_crypt (des_ctx *ctx, const char 
 }
 
 void
-tripledes_set2keys (tripledes_ctx *ctx, const char * key1, const char * key2)
+gl_3des_set2keys (gl_3des_ctx *ctx, const char * key1, const char * key2)
 {
   int i;
 
@@ -603,7 +595,7 @@ tripledes_set2keys (tripledes_ctx *ctx, 
 }
 
 void
-tripledes_set3keys (tripledes_ctx *ctx, const char * key1,
+gl_3des_

Re: gnulib-tool: an autobuild facility

2007-03-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> "gnulib-tool --create-megatestdir --dir=..."

Don't forget to add --with-tests too.

Should --create-megatestdir add this automatically?

/Simon




Re: cycle-check: needs inline

2007-03-12 Thread Jim Meyering
Bruno Haible <[EMAIL PROTECTED]> wrote:
> Hi Jim,
>
> The cycle-check module uses 'inline', therefore should make sure it's 
> supported
> or defined away. Currently it leads to a failure like this, on Solaris 2.5.1
> with SunPRO C 5.0:
>
> cc -O -DHAVE_CONFIG_H -I. -I..  -g -c cycle-check.c
> "cycle-check.c", line 38: undefined or not a type: inline
>
> Here's a proposed patch.
>
> 2007-03-11  Bruno Haible  <[EMAIL PROTECTED]>
>
>   * m4/cycle-check.m4 (gl_CYCLE_CHECK): Require AC_C_INLINE.

That's fine, even though I consider such an
old version of Solaris to be irrelevant.

You're welcome to apply it.




Re: i-ring: needs stdbool

2007-03-12 Thread Jim Meyering
Bruno Haible <[EMAIL PROTECTED]> wrote:
> The i-ring.h file includes . Therefore it should depend on
> the 'stdbool' module. Currently it gives an error on Solaris 10 for example:
>
> cc -xarch=v9 -O -DHAVE_CONFIG_H -I. -I..  -g -c i-ring.c
> "/usr/include/stdbool.h", line 42: #error: "Use of  is valid only 
> in a c99 compilation environment."
> cc: acomp failed for i-ring.c
>
> I'm applying this:
>
> 2007-03-11  Bruno Haible  <[EMAIL PROTECTED]>
>
>   * modules/i-ring (Depends-on): Add stdbool.

Thanks for fixing those.




Idea for linked-list

2007-03-12 Thread Simon Josefsson
I'm looking at Bruno's data structure modules, in particular
linked-list, and consider using it to hold the information related to
all open fd's handled by select() in GnuTLS's gnutls-serv.  One
important feature of our current implementation is that I can register
my custom "free" function, which can do more things than just memory
deallocation:

static void
listener_free (listener_item * j)
{

  if (j->http_request)
free (j->http_request);
  if (j->http_response)
free (j->http_response);
  if (j->fd >= 0)
{
  gnutls_bye (j->tls_session, GNUTLS_SHUT_WR);
  shutdown (j->fd, 2);
  close (j->fd);
  gnutls_deinit (j->tls_session);
}
}

This function is invoked for each list item that for any reason is
being removed from the list.  Is it possible to do this with the
linked-list module?  By reading gl_anylinked_list2.h it appear as
de-allocating a list item is pretty hard coded, and several function
do 'free' on it.

I imagine some function to register a "free"-handler, and it would be
used by all other functions that want to de-allocate a particular
node.

Thoughts?

/Simon




Re: gnulib-tool: an autobuild facility

2007-03-12 Thread Bruno Haible
Simon Josefsson wrote:
> Should --create-megatestdir add this automatically?

I'd say, better keep it optional. Although currently I use --with-tests always,
there are cases when one cares whether the code compiles in the first place,
ignoring the tests.

Bruno




Re: cycle-check: needs inline

2007-03-12 Thread Bruno Haible
Jim Meyering wrote:
> > * m4/cycle-check.m4 (gl_CYCLE_CHECK): Require AC_C_INLINE.
> 
> That's fine, even though I consider such an
> old version of Solaris to be irrelevant.

The same lack of 'inline' is also observed on Solaris 7 and HP-UX 11. [1]

> You're welcome to apply it.

Done.

Bruno


[1] http://lists.gnu.org/archive/html/bug-gnulib/2006-11/msg00055.html




Re: des: compilation error on MacOS X

2007-03-12 Thread Bruno Haible
Simon Josefsson wrote:
> I changed the namespace to gl_des as below.

After the complaints "gnulib is changing too fast" a few weeks ago, I think
it may help the gnulib users if we keep track of the incompatible changes
(removed modules, renamed functions etc.). I'm making a start by adding this
NEWS file.

==
Important notes
---

User visible incompatible changes
-

2007-03-12  The types and functions in lib/des.h have been renamed:
des_ctx -> gl_des_ctx, tripledes_ctx -> gl_3des_ctx,
des_is_weak_key -> gl_des_is_weak_key,
des_setkey -> gl_des_setkey, des_makekey -> gl_des_makekey,
des_ecb_crypt -> gl_des_ecb_crypt,
des_ecb_encrypt -> gl_des_ecb_encrypt,
des_ecb_decrypt -> gl_des_ecb_decrypt,
tripledes_set2keys -> gl_3des_set2keys,
tripledes_set3keys -> gl_3des_set3keys,
tripledes_makekey -> gl_3des_makekey,
tripledes_ecb_crypt -> gl_3des_ecb_crypt.





adding bootstrap and bootstrap.conf

2007-03-12 Thread Jim Meyering
FYI, I've just added these two new files.

* build-aux/bootstrap: New file.
* build-aux/bootstrap.conf: New file, from coreutils.

Variants of this bootstrap script are being used in at least 6 or
7 different projects, and having it here seems like the best way
to keep everyone up to date.  However there's plenty of room for
improvement.  First of all, there is no associated module -- yet.
Part of the trouble is that there is no mechanism to tell gnulib-tool
that a file in build-aux/ really belongs in the top-level directory.
This is similar to Simon's problem with GNUMakefile.
We could always document the need to run build-aux/bootstrap ...
rather than simply ./bootstrap, but that would be a step backwards.

Secondly, it may not make sense to include bootstrap.conf at all.
I include it solely as an example.  Obviously, individual projects
will have to customize theirs.

Index: build-aux/bootstrap
===
RCS file: build-aux/bootstrap
diff -N build-aux/bootstrap
--- /dev/null   1 Jan 1970 00:00:00 -
+++ build-aux/bootstrap 12 Mar 2007 13:39:40 -
@@ -0,0 +1,539 @@
+#! /bin/sh
+
+# Bootstrap this package from checked-out sources.
+
+# Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# Written by Paul Eggert.
+
+nl='
+'
+
+# Ensure file names are sorted consistently across platforms.
+# Also, ensure diagnostics are in English, e.g., "wget --help" below.
+LC_ALL=C
+export LC_ALL
+
+# Temporary directory names.
+bt='._bootmp'
+bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
+bt2=${bt}2
+
+usage() {
+  echo >&2 "\
+Usage: $0 [OPTION]...
+Bootstrap this package from the checked-out sources.
+
+Options:
+ --gnulib-srcdir=DIRNAME  Specify the local directory where gnulib
+  sources reside.  Use this if you already
+  have gnulib sources on your machine, and
+  do not want to waste your bandwidth downloading
+  them again.
+ --copy   Copy files instead of creating symbolic links.
+ --force  Attempt to bootstrap even if the sources seem
+  not to have been checked out.
+ --skip-poDo not download po files.
+ --cvs-user=USERNAME  Set the username to use when checking out
+  sources from the gnulib repository.
+
+If the file .bootstrap.conf exists in the current working directory, its
+contents are read as shell variables to configure the bootstrap.
+
+Running without arguments will suffice in most cases.
+"
+}
+
+# Configuration.
+
+# List of gnulib modules needed.
+gnulib_modules=
+
+# Any gnulib files needed that are not in modules.
+gnulib_files=
+
+# Translation Project URL, for the registry of all projects
+# and for the translation-team master directory.
+TP_URL='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
+TP_PO_URL='http://www.iro.umontreal.ca/translation/teams/PO/'
+
+extract_package_name='
+  /^AC_INIT(/{
+ /.*,.*,.*,/{
+   s///
+   s/[][]//g
+   p
+   q
+ }
+ s/AC_INIT(\[*//
+ s/]*,.*//
+ s/^GNU //
+ y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ s/[^A-Za-z0-9_]/-/g
+ p
+  }
+'
+package=`sed -n "$extract_package_name" configure.ac` || exit
+
+build_aux=build-aux
+# Extra files from gnulib, which override files from other sources.
+gnulib_extra_files="
+   $build_aux/install-sh
+   $build_aux/missing
+   $build_aux/mdate-sh
+   $build_aux/texinfo.tex
+   $build_aux/depcomp
+   $build_aux/config.guess
+   $build_aux/config.sub
+   doc/INSTALL
+"
+
+# Other locale categories that need message catalogs.
+EXTRA_LOCALE_CATEGORIES=
+
+# Additional xgettext options to use.  Use "\\\newline" to break lines.
+XGETTEXT_OPTIONS='\\\
+ --flag=_:1:pass-c-format\\\
+ --flag=N_:1:pass-c-format\\\
+ --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
+'
+
+# Files we don't want to import.
+excluded_files=
+
+# File that should exist in the top directory of a checked out hierarchy,
+# but not in a distribution tarball.
+checkout_only_file=README-hacking
+
+# Whether to use copies instead of symlinks.
+copy=false
+
+# Overrid

*printf declarations in stdio.h?

2007-03-12 Thread Simon Josefsson
I haven't been paying attention to the *printf discussions, but
looking at current CVS, shouldn't the vasprintf module use stdio.h for
the prototypes?

/Simon

2007-03-12  Simon Josefsson  <[EMAIL PROTECTED]>

* modules/vasprintf: Depend on stdio for prototypes, and remove
vasprintf.h.

* lib/stdio_.h: Declare asprintf and vasprintf, from vasprintf.h.

* lib/asprintf.c: Use stdio.h for prototypes.
* lib/vasprintf.c: Ditto.

* lib/vasprintf.h: File removed.

Index: modules/vasprintf
===
RCS file: /sources/gnulib/gnulib/modules/vasprintf,v
retrieving revision 1.4
diff -u -p -r1.4 vasprintf
--- modules/vasprintf   13 Oct 2006 12:40:23 -  1.4
+++ modules/vasprintf   12 Mar 2007 14:34:08 -
@@ -2,13 +2,13 @@ Description:
 vsprintf with automatic memory allocation.
 
 Files:
-lib/vasprintf.h
 lib/vasprintf.c
 lib/asprintf.c
 m4/vasprintf.m4
 
 Depends-on:
 vasnprintf
+stdio
 
 configure.ac:
 gl_FUNC_VASPRINTF
@@ -16,7 +16,7 @@ gl_FUNC_VASPRINTF
 Makefile.am:
 
 Include:
-"vasprintf.h"
+
 
 License:
 LGPL
Index: lib/stdio_.h
===
RCS file: /sources/gnulib/gnulib/lib/stdio_.h,v
retrieving revision 1.13
diff -u -p -r1.13 stdio_.h
--- lib/stdio_.h10 Mar 2007 11:24:15 -  1.13
+++ lib/stdio_.h12 Mar 2007 14:34:08 -
@@ -183,6 +183,16 @@ extern int vsprintf (char *str, const ch
  vsprintf (b, f, a))
 #endif
 
+#if @GNULIB_VASPRINTF@
+# if REPLACE_VASPRINTF
+#  define asprintf rpl_asprintf
+#  define vasprintf rpl_vasprintf
+# endif
+  extern int asprintf (char **result, const char *format, ...)
+__attribute__ ((__format__ (__printf__, 2, 3)));
+  extern int vasprintf (char **result, const char *format, va_list args)
+__attribute__ ((__format__ (__printf__, 2, 0)));
+#endif
 
 #ifdef __cplusplus
 }
Index: lib/asprintf.c
===
RCS file: /sources/gnulib/gnulib/lib/asprintf.c,v
retrieving revision 1.4
diff -u -p -r1.4 asprintf.c
--- lib/asprintf.c  14 Sep 2006 14:18:36 -  1.4
+++ lib/asprintf.c  12 Mar 2007 14:34:08 -
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006, 2007 Free Software Foundation, Inc.
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
 #include 
 
 /* Specification.  */
-#include "vasprintf.h"
+#include 
 
 #include 
 
Index: lib/vasprintf.c
===
RCS file: /sources/gnulib/gnulib/lib/vasprintf.c,v
retrieving revision 1.8
diff -u -p -r1.8 vasprintf.c
--- lib/vasprintf.c 14 Sep 2006 14:18:36 -  1.8
+++ lib/vasprintf.c 12 Mar 2007 14:34:08 -
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006, 2007 Free Software Foundation, Inc.
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
 #include 
 
 /* Specification.  */
-#include "vasprintf.h"
+#include 
 
 #include 
 #include 




Re: inet_ntop and Solaris

2007-03-12 Thread Yoann Vandoorselaere
Le lundi 12 mars 2007 à 12:18 +0100, Simon Josefsson a écrit :
> Bruno Haible <[EMAIL PROTECTED]> writes:
> 
> > Should gnulib compile its own inet_ntop() in this situation?
> > If yes, you need to add a '#define inet_ntop rpl_inet_ntop' to gnulib's
> > arpa/inet.h. If no, the autoconf test should look whether inet_ntop is
> > available in -lnsl, and make this additional library available in a 
> > variable,
> > say, LIBINET.
> 
> IMHO, gnulib should use -lnsl here.

Yes, that would be fine.

-- 
Yoann Vandoorselaere <[EMAIL PROTECTED]>





Re: des: compilation error on MacOS X

2007-03-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> Simon Josefsson wrote:
>> I changed the namespace to gl_des as below.
>
> After the complaints "gnulib is changing too fast" a few weeks ago, I think
> it may help the gnulib users if we keep track of the incompatible changes
> (removed modules, renamed functions etc.). I'm making a start by adding this
> NEWS file.

Makes sense, thanks!

Although I believe the impact of this should be small, if people use
the gc-des module as the high-level interface to DES functions.  Doing
that is better.  I added a note about this.

/Simon




Re: gnulib-tool: an autobuild facility

2007-03-12 Thread Simon Josefsson
Bruno Haible <[EMAIL PROTECTED]> writes:

> The use of this facility is as follows:
>   1) On a machine with recent automake, autoconf, m4 installed and with a
>  gnulib cvs checkout (typically a Linux machine), use
> "gnulib-tool --create-megatestdir --dir=..."
>  Note: The created directory uses ca. 512 MB on disk.
>   2) Transfer this directory to a build machine (HP-UX, Cygwin, or whatever).

Step 2 can be simplified by doing:

./configure
make dist

since gnulib-tool already create a dummy configure.ac that
AC_CONFIG_SUBDIR include every gnulib module.  Running this
./configure takes a considerable amount of time, though.

I moved all this into the gnulib manual.

/Simon




Re: gnulib-tool: an autobuild facility

2007-03-12 Thread Bruno Haible
Simon Josefsson wrote:
> >   2) Transfer this directory to a build machine (HP-UX, Cygwin, or 
> > whatever).
> 
> Step 2 can be simplified by doing:
> 
> ./configure
> make dist
> 
> since gnulib-tool already create a dummy configure.ac that
> AC_CONFIG_SUBDIR include every gnulib module.  Running this
> ./configure takes a considerable amount of time, though.

Yes, this "./configure" of all modules takes a long time. Whereas the
"transfer this directory to the build machine" task can be a simple 'cp'
command or even a no-op, if you're using NFS.

Bruno




Re: Membership request for group gnulib - GNU portability library

2007-03-12 Thread Ben Pfaff
Bruno Haible <[EMAIL PROTECTED]> writes:

>> any future modules that I contribute (I have a few in mind)
>
> Of course I'd like to hear details :-) (when you have time for it).

The one that comes to mind immediately is to finish up and check
in the module for the "trunc" and "round" families of functions,
which GNU PSPP wants and I've started work on but never finished.
Then, anything else wanted by GNU PSPP; I'm not sure what at the
moment.
-- 
"I was born lazy.  I am no lazier now than I was forty years ago, 
 but that is because I reached the limit forty years ago.  You can't 
 go beyond possibility."
--Mark Twain




Re: *printf declarations in stdio.h?

2007-03-12 Thread Bruno Haible
Simon Josefsson wrote:
> I haven't been paying attention to the *printf discussions, but
> looking at current CVS, shouldn't the vasprintf module use stdio.h for
> the prototypes?

Yes, you're right. Since, as Paul said, gnulib not only attempts to mimic
POSIX APIs but also glibc APIs, and glibc declares vasprintf() and asprintf()
in , gnulib should do the same.

> 2007-03-12  Simon Josefsson  <[EMAIL PROTECTED]>
> 
>   * modules/vasprintf: Depend on stdio for prototypes, and remove
>   vasprintf.h.
> 
>   * lib/stdio_.h: Declare asprintf and vasprintf, from vasprintf.h.
> 
>   * lib/asprintf.c: Use stdio.h for prototypes.
>   * lib/vasprintf.c: Ditto.
> 
>   * lib/vasprintf.h: File removed.

Correct but a few things are missing:
  - While moving the declarations to , you dropped the specification
comments. They are essential.
  - While moving the declarations to , you dropped the
#if !HAVE_VASPRINTF. When an implementation has the functions and they
work fine, we don't want to risk a compilation error due to redeclaration
of system functions. The declarations should be skipped in this case.
  - The '# if REPLACE_VASPRINTF' needs to be turned into a test of an
AC_SUBSTed variable, so that the generated stdio.h doesn't need a
config.h.
  - After you settled on the changes to lib/stdio_.h, modules/stdio and
m4/stdio_h.m4 need to be updated accordingly.
  - Also update the callers:
   fgrep '"vasprintf.h"' lib/*.c tests/*.c
shows a few places to update.

Bruno





Re: test-printf-frexp ?

2007-03-12 Thread Bruno Haible
Simon Josefsson wrote:
> Bruno Haible <[EMAIL PROTECTED]> writes:
> 
> > According to the autobuild logs [1], the module 'printf-frexp' fails the
> > tests on a Linux/x86 machine of yours. I cannot reproduce this, on a
> > glibc-2.3.6 machine and on a glibc-2.5 machine.
> > ...
> > [1] http://autobuild.josefsson.org/gnulib/log-200703101113121276000.txt
> 
> I can't reproduce this with only -g, -O2 is required to
> trigger this.  ...
> $ gcc --version
> gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

Thanks. With gcc-4.1.2 I could reproduce it as well. I'm applying this fix.


2007-03-12  Bruno Haible  <[EMAIL PROTECTED]>

* tests/test-printf-frexp.c (main): Declare x as volatile.

*** tests/test-printf-frexp.c   25 Feb 2007 14:21:42 -  1.1
--- tests/test-printf-frexp.c   12 Mar 2007 22:38:41 -
***
*** 40,46 
  main ()
  {
int i;
!   double x;
  
for (i = 1, x = 1.0; i <= DBL_MAX_EXP; i++, x *= 2.0)
  {
--- 40,51 
  main ()
  {
int i;
!   /* The use of 'volatile' guarantees that excess precision bits are dropped
!  when dealing with denormalized numbers.  It is necessary on x86 systems
!  where double-floats are not IEEE compliant by default, to avoid that the
!  results become platform and compiler option dependent.  'volatile' is a
!  portable alternative to gcc's -ffloat-store option.  */
!   volatile double x;
  
for (i = 1, x = 1.0; i <= DBL_MAX_EXP; i++, x *= 2.0)
  {





Re: glob: compilation error due to 'restrict'

2007-03-12 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes:

> Changing the function definition to use ANSI C argument list syntax (without
> adding 'restrict' there) fixes the problem. Changing the function definition
> by adding 'restrict' in the first and fourth argument (keeping the K&R syntax)
> also fixes the problem.
>
> Which fix to choose? Which one is likely to please the glibc developers 
> better?

Let's keep the K&R syntax please.  Other glibc developers prefer that
for some obscure reason (for external functions only).  Thanks for
finding this problem.




Re: adding bootstrap and bootstrap.conf

2007-03-12 Thread Bruno Haible
Hello Jim,

> Variants of this bootstrap script are being used in at least 6 or
> 7 different projects, and having it here seems like the best way
> to keep everyone up to date.  However there's plenty of room for
> improvement.

Well, I'd suggest two improvements:

First, the name. "Bootstrapping" means, according to Wikipedia [1][2],
a "solution to a chicken-and-egg problem". There is no such chicken-and-egg
problem here. A 'bootstrap' script makes sense for GNU bash or GNU sed, which
cannot assume that the user has sufficient tools for running a 'configure'
script. Or for GNU bison which needs a parser generated by itself to parse
its input files. But here? The tasks are to copy some files and generate
some others through the auto* tools.

GNOME and some other GNU projects use the name 'autogen.sh' for scripts with
this purpose. It's a well-known and self-explaining name. I'd suggest to
rename 'bootstrap' to 'autogen.sh'.

Second, the script applies gnulib-tool on a scratch subdirectory. This is
worrisome: it indicates that gnulib-tool does some things the wrong way.
Can you or Paul explain what is missing in gnulib-tool's working?

   Bruno


[1] http://en.wikipedia.org/wiki/Bootstrapping_(computing)
[2] http://en.wikipedia.org/wiki/Bootstrapping_(compilers)





Re: quotearg: fix compilation on Solaris

2007-03-12 Thread Paul Eggert
Bruno Haible <[EMAIL PROTECTED]> writes:

> 2007-03-11  Bruno Haible  <[EMAIL PROTECTED]>
>
>   * lib/quotearg.c: Include  early, before the definition of
>   the iswprint macro. Needed on Solaris 2.5.1.

Thanks; please install.  (I just now tried to install it but the CVS
server access was down.)