bootstrap: fix HPUX/grep portability problem

2007-03-17 Thread Jim Meyering

* build-aux/bootstrap: Don't use \ in grep regexp.  For HP-UX.

Index: build-aux/bootstrap
===
RCS file: /cvsroot/gnulib/gnulib/build-aux/bootstrap,v
retrieving revision 1.3
diff -u -p -r1.3 bootstrap
--- build-aux/bootstrap 16 Mar 2007 21:03:43 -  1.3
+++ build-aux/bootstrap 17 Mar 2007 08:58:04 -
@@ -468,7 +468,7 @@ done

 # Import from gettext.
 with_gettext=yes
-grep '^[]*AM_GNU_GETTEXT_VERSION\' configure.ac /dev/null || \
+grep '^[]*AM_GNU_GETTEXT_VERSION(' configure.ac /dev/null || \
 with_gettext=no

 if test $with_gettext = yes; then




[BUG] Check for AC_CONFIG_AUX_DIR is incorrect

2007-03-17 Thread Alfred M. Szmidt
Hey,

The check for AC_CONFIG_AUX_DIR is incorrect, since autoconf (really,
m4) allows one to quote arguments.  So if ones configure.ac contains
the following valid code:

AC_CONFIG_AUX_DIR([build-aux])

the check will fail.  Not entierly sure how to handle it since m4
allows one to set the quote character.  Any ideas?

Cheers.




Re: [BUG] Check for AC_CONFIG_AUX_DIR is incorrect

2007-03-17 Thread Jim Meyering
Alfred M. Szmidt [EMAIL PROTECTED] wrote:
 The check for AC_CONFIG_AUX_DIR is incorrect, since autoconf (really,
 m4) allows one to quote arguments.  So if ones configure.ac contains
 the following valid code:

 AC_CONFIG_AUX_DIR([build-aux])

 the check will fail.  Not entierly sure how to handle it since m4
 allows one to set the quote character.  Any ideas?

If someone changes the m4 quote character they'll have other things to
worry about :-)

Detect use of AC_CONFIG_AUX_DIR also when its argument is quoted.
* build-aux/bootstrap: Put s around use of $build_aux, in case
someone uses a name containing shell meta-characters.
Reported by Alfred M. Szmidt.

Index: build-aux/bootstrap
===
RCS file: /cvsroot/gnulib/gnulib/build-aux/bootstrap,v
retrieving revision 1.4
diff -u -p -r1.4 bootstrap
--- build-aux/bootstrap 17 Mar 2007 08:58:43 -  1.4
+++ build-aux/bootstrap 17 Mar 2007 11:51:39 -
@@ -169,10 +169,15 @@ insert_sorted_if_absent() {
 }

 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
-grep '^[]*AC_CONFIG_AUX_DIR('$build_aux')' configure.ac /dev/null ||
+found_aux_dir=no
+grep '^[]*AC_CONFIG_AUX_DIR(\['$build_aux'\])' configure.ac \
+/dev/null  found_aux_dir=yes
+grep '^[]*AC_CONFIG_AUX_DIR('$build_aux')' configure.ac \
+/dev/null  found_aux_dir=yes
+if test $found_aux_dir = no; then
   {
 echo $0: expected line not found in configure.ac. Add the following: 2
-echo   AC_CONFIG_AUX_DIR($build_aux) 2.
+echo   AC_CONFIG_AUX_DIR([$build_aux]) 2.
   }

 # If $build_aux doesn't exist, create it now, otherwise some bits




Re: [BUG] Check for AC_CONFIG_AUX_DIR is incorrect

2007-03-17 Thread Jim Meyering
Jim Meyering [EMAIL PROTECTED] wrote:
...
 +if test $found_aux_dir = no; then
{
  echo $0: expected line not found in configure.ac. Add the following: 
 2
 -echo   AC_CONFIG_AUX_DIR($build_aux) 2.
 +echo   AC_CONFIG_AUX_DIR([$build_aux]) 2.
}

Whoops.  I've just fixed the syntax error introduced above.




use of thread-unsafe localeconv in vasprintf

2007-03-17 Thread Simon Josefsson
In gsasl I have a script that try to help me make sure I don't use
thread unsafe functions (included below for reference), and after
updating gnulib for it, it triggers on vasnprintf.c:

../lib/gl/vasnprintf.c:#include locale.h  /* localeconv() */
../lib/gl/vasnprintf.c: localeconv () - 
decimal_point;
../lib/gl/vasnprintf.c: localeconv () - 
decimal_point;

According to:

http://www.opengroup.org/onlinepubs/009695399/functions/localeconv.html

The localeconv() function need not be reentrant. A function that is
not required to be reentrant is not required to be thread-safe.

Is there a thread-safe replacement for localeconv?  If not, can we
install something like the patch below, to allow thread-safe
vasnprintf?

--- vasnprintf.c12 Mar 2007 12:41:12 +0100  1.28
+++ vasnprintf.c17 Mar 2007 13:29:42 +0100  
@@ -34,7 +34,9 @@
 # include vasnprintf.h
 #endif
 
+#if !DONT_USE_LOCALECONV
 #include locale.h/* localeconv() */
+#endif
 #include stdio.h /* snprintf(), sprintf() */
 #include stdlib.h/* abort(), malloc(), realloc(), free() */
 #include string.h/* memcpy(), strlen() */
@@ -497,8 +499,10 @@
  if ((flags  FLAG_ALT)
  || mantissa  0.0L || precision  0)
{
- const char *point =
-   localeconv () - decimal_point;
+ const char *point = .;
+#if !DONT_USE_LOCALECONV
+ point = localeconv () - decimal_point;
+#endif
  /* The decimal point is always a single byte:
 either '.' or ','.  */
  *p++ = (point[0] != '\0' ? point[0] : '.');
@@ -645,8 +649,10 @@
  if ((flags  FLAG_ALT)
  || mantissa  0.0 || precision  0)
{
- const char *point =
-   localeconv () - decimal_point;
+ const char *point = .;
+#if !DONT_USE_LOCALECONV
+ point = localeconv () - decimal_point;
+#endif
  /* The decimal point is always a single byte:
 either '.' or ','.  */
  *p++ = (point[0] != '\0' ? point[0] : '.');

/Simon

#!/bin/sh

# Copyright (C) 2004, 2005 Simon Josefsson
#
# This file 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 file 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 file; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

FILES=$@
FILES=${FILES:-$THREADSAFETY_FILES}

if test -z $FILES; then
echo Usage: $0 [FILE...]
exit 1
fi

# http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html
UNSAFE=asctime basename catgets crypt ctime dbm_clearerr dbm_close dbm_delete 
dbm_error dbm_fetch dbm_firstkey dbm_nextkey dbm_open dbm_store dirname dlerror 
drand48 ecvt encrypt endgrent endpwent endutxent fcvt ftw gcvt getc_unlocked 
getchar_unlocked getdate getenv getgrent getgrgid getgrnam gethostbyaddr 
gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getopt 
getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid 
getservbyname getservbyport getservent getutxent getutxid getutxline gmtime 
hcreate hdestroy hsearch inet_ntoa l64a lgamma lgammaf lgammal localeconv 
localtime lrand48 mrand48 nftw nl_langinfo ptsname putc_unlocked 
putchar_unlocked putenv pututxline rand readdir setenv setgrent setkey setpwent 
setutxent strerror strtok ttyname unsetenv wcstombs wctomb

set -- $UNSAFE
cmd=-e [^_0-9a-z]($1
shift
while test $1; do
cmd=${cmd}|$1
shift
done
cmd=${cmd})[^_0-9a-z]*\(

if egrep $cmd $FILES; then
exit 1
fi

exit 0




Re: adding bootstrap and bootstrap.conf

2007-03-17 Thread Jim Meyering
Bruno Haible [EMAIL PROTECTED] wrote:

 Jim Meyring wrote:
 My impression is that few (if any) of the autogen scripts use gnulib

 The one gettext does.

 there's another definition (the first one when I type dict bootstrap)
 that is more evocative: to load and initialize the operating system on
 a computer.  Normally abbreviated to {boot}.

 Well, that's the definition for computer-illiterate persons, not for
 hackers :-) Besides that, gnulib is not an operating system.

I'd call it a historical definition, rather than one
for the computer-illiterate.

Another feature: bootstrap adds .cvsignore and .gitignore
entries for files it supplies.

A missing feature: files supplied by gnulib-tool should be
removed by make maintainer-clean.  If gnulib-tool doesn't
do that soon, I'll be changing bootstrap to do it.

It'd be great if gnulib-tool could subsume more of the
functionality in this bootstrap script.




Re: adding bootstrap and bootstrap.conf

2007-03-17 Thread Ben Pfaff
Bruno Haible [EMAIL PROTECTED] writes:

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

One oddity of the name autogen.sh is that there is a GNU
project named autogen that is not, as far as I know, related to
autogen.sh.
-- 
I don't want to learn the constitution and the declaration of
 independence (marvelous poetry though it be) by heart, and worship the
 flag and believe that there is a god and the dollar is its prophet.
--Maarten Wiltink in the Monastery





Re: adding bootstrap and bootstrap.conf

2007-03-17 Thread Bruce Korb
Ben Pfaff wrote:
 Bruno Haible [EMAIL PROTECTED] writes:
 
 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'.
 
 One oddity of the name autogen.sh is that there is a GNU
 project named autogen that is not, as far as I know, related to
 autogen.sh.

I think the name is:  I proposed doing some GNOME stuff with my tool
a decade or so ago and the upshot was a bootstrap script named, autogen.sh.
:-)  Otherwise, you are correct.  No connection.




Re: another vasnprintf fix

2007-03-17 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Bruno Haible on 3/17/2007 6:32 PM:
   * lib/vasnprintf.c (EOVERFLOW): New fallback definition.
   (VASNPRINTF): Fail with EOVERFLOW when the given allocated size is
   larger than INT_MAX, or when it grow to a value larger than INT_MAX.

This seems awkward to me.   I agree that if vasnprintf inherits an INT_MAX
limit because it internally uses another *printf function with an INT_MAX
limit, then it should not loop endlessly.  But since vasnprintf has the
nice API property that, unlike all other *printf functions, it does not
return an int, it should not need to be limited by INT_MAX; otherwise you
are introducing an artificial limitation which goes against the GNU
philosophy.  Particularly on platforms where size_t is 64 bits, but int is
32 bits, I think it would be nice to have a *printf function that can
handle a chunk of memory larger than 2 gigabytes.

   * lib/vsprintf.c (vsprintf): Don't pass a size  INT_MAX to vasnprintf.
   * lib/sprintf.c (sprintf): Likewise.

This part I agree with.

- --
Don't work too hard, make some time for fun as well!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF/Kid84KuGfSFAYARAgpNAKDN4Qgm4vU2JL2F9GeN58I9Dr4IpACgvgjA
pHCKtxuOcmPc86TJzpFwihI=
=40ew
-END PGP SIGNATURE-