Re: gnulib-tool: refusing to do nothing

2005-09-12 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Ben Pfaff on 9/9/2005 9:53 AM:
 Until I update gnulib from CVS, gnulib-tool --import (without
 any extra arguments) obtained the list of modules from gl_MODULES
 in configure.ac and imported them into the source tree.
 
 Now, it seems to no longer read gl_MODULES and this invocation
 fails with refusing to do nothing.  This is not the behavior I
 expect or the documented behavior.
 
 What is the new expected usage model?  (Or am I missing something
 else?)

gl_MODULES has moved out of configure.ac and into gnulib-cache.m4, in
order to reduce churn on configure.ac for the entire project, as well as
to cache a few more parameters and to allow multiple gnulib directories in
a single project.
http://lists.gnu.org/archive/html/bug-gnulib/2005-08/msg00241.html

Ulitmately, you now need to run gnulib once with all parameters explicitly
set on the command line, then check in gnulib-cache.m4 to CVS.  Then, all
other users of CVS can run the single 'gnulib-tool --import' as part of
bootstrap, and pick up the contents of gnulib-cache.m4 to guide it.  You
may also want to use --no-changelog in your bootstrap script, so that
gnulib-tool only does changelog entries when not bootstrapping a fresh CVS
checkout.

This does not quite work if the m4 directory is not in the standard
location; for the m4 project, where the m4 base is ./ltdl/m4 instead of
./m4 I found I had to tell bootstrap to do 'gnulib-tool --import
- --m4-base=$config_macro_dir --no-changelog':
http://lists.gnu.org/archive/html/m4-patches/2005-09/msg0.html

- --
Life is short - so eat dessert first!

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

iD8DBQFDJXOv84KuGfSFAYARAsMEAJ9bq/jUfPLUbhxxZNfq9Qp70dhDCwCeJ3sL
7uoHik8AcYCO495D/NmNr78=
=yuwQ
-END PGP SIGNATURE-


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: socklen_t

2005-09-12 Thread Stepan Kasal
Hello,

On Thu, Sep 01, 2005 at 04:43:30AM -0500, Albert Chin wrote:
  for arg2 in struct sockaddr void; do
 for t in int size_t unsigned long unsigned long; do
AC_TRY_COMPILE([
   #include sys/types.h
   #include sys/socket.h
 
   int getpeername (int, $arg2 *, $t *);
],[
   $t len;
   getpeername(0,0,len);
],[
   socklen_t_equiv=$t
   break
])
 done
  done

I see two problems with this code:

1) Wouldn't break 2 be more appropriate?

2) The use of `break' or `continue' inside `AC_*_IFELSE' (or the obsolete
   AC_TRY_*) is not safe; it skips the cleanup of that macro.
   Something like this is better:

...
],[
   socklen_t_equiv=$t
])
 done
 test -z $socklen_t_equiv  break
  done

  if -z $socklen_t_equiv; then
 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
  fi

Have a nice day,
Stepan Kasal


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: glob_.h glibc

2005-09-12 Thread Derek Price
Paul Eggert wrote:

OK, but in that case shouldn't the AC_REQUIRE([AC_GNU_SOURCE]) be in
gl_GLOB rather than gl_PREREQ_GLOB?
  


I don't think so.  gl_GLOB tests for the _GNU_GLOB_INTERFACE_VERSION
macro from gnu-versions.h  a known bug in GNU glob's POSIX support. 
Neither requires the GNU extensions enabled.

Also, gl_GLOB_SUBSTITUTE can enable the glob module without a call to
gl_GLOB at all, so at the least, a call to AC_REQUIRE([AC_GNU_SOURCE])
would still need to remain in gl_GLOB_PREREQ.

Regards,

Derek

-- 
Derek R. Price
CVS Solutions Architect
Ximbiot http://ximbiot.com
v: +1 717.579.6168
f: +1 717.234.3125
mailto:[EMAIL PROTECTED]




___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


small improvement to base64

2005-09-12 Thread Ralf Wildenhues
Hi Simon,

Please apply the tiny patch below to the base64 module to fix a typo and
to put the long constant string in the initialized data section.  This
avoids reinitialization of the string upon function invocation and
should thus generally be about a wee bit faster.  :)

Cheers,
Ralf

2005-09-12  Ralf Wildenhues  [EMAIL PROTECTED]  (tiny change)

* lib/base64.c: Typo.
(base64_encode): Put b64str in initialized data section.

Index: lib/base64.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/base64.c,v
retrieving revision 1.4
diff -u -r1.4 base64.c
--- lib/base64.c27 Jun 2005 22:05:57 -  1.4
+++ lib/base64.c12 Sep 2005 17:04:09 -
@@ -36,7 +36,7 @@
  *   FAIL: input too long
  * if (out == NULL)
  *   FAIL: memory allocation error
- * OK: data in OUT/LEN.
+ * OK: data in OUT/OUTLEN.
  *
  */
 
@@ -65,7 +65,7 @@
 base64_encode (const char *restrict in, size_t inlen,
   char *restrict out, size_t outlen)
 {
-  const char b64str[64] =
+  static const char b64str[64] =
 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/;
 
   while (inlen  outlen)


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: mmapping of /dev/zero always fails on darwin

2005-09-12 Thread Derek Price
Peter O'Gorman wrote:

 As you can see from this little snippet of gcc configure, you can't
 mmap /dev/zero on darwin.

AC_CACHE_CHECK([whether mmap from /dev/zero works],
   gcc_cv_func_mmap_dev_zero,
   [# Add a system to this blacklist if it has mmap() but /dev/zero
# does not exist, or if mmapping /dev/zero does not give anonymous
# zeroed pages with both the following properties:
# 1. If you map N consecutive pages in with one call, and then
#unmap any subset of those pages, the pages that were not
#explicitly unmapped remain accessible.
# 2. If you map two adjacent blocks of memory and then unmap them
#both at once, they must both go away.
# Systems known to be in this category are Windows (all variants),
# VMS, and Darwin.


I don't suppose you could come up with a configure test or a short C
program that fails to compile (preferrably) or run (if necessary) to
spot this, short of actually switching on the system name or something
similar?

Regards,

Derek

-- 
Derek R. Price
CVS Solutions Architect
Ximbiot http://ximbiot.com
v: +1 717.579.6168
f: +1 717.234.3125
mailto:[EMAIL PROTECTED]




___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


md5 and sha1 fixes from coreutils (plus a few of my own)

2005-09-12 Thread Paul Eggert
I installed this:

2005-09-12  Paul Eggert  [EMAIL PROTECTED]

Merge glibc and coreutils changes into gnulib, plus a few
extra fixes.
* lib/md5.c: Use #error rather than a string.
(CYCLIC): New macro, from glibc source.  Use it instead of rol.
* lib/md5.h (__GNUC_PREREQ, __THROW): Define if not defined already.
(__attribute__): Define to empty for non recent-GCC.
(__md5_buffer, __md5_finish_ctx, __md5_init_ctx, __md5_process_block):
(__md5_process_bytes, __md5_read_ctx, __md5_stream):
Renamed from their non-__ counterparts, with new macros replacing
them if not _LIBC.  Add __THROW attribute.
(rol): Remove.
(struct md5_ctx): Align buffer if using GCC.
* lib/sha1.h (struct sha1_ctx): Likewise.
* lib/sha1.c (SWAP): Renamed from NOTSWAP.  All uses changed.
The old name was backwards.
(NOTSWAP): Remove; not used.
(rol): New macro, moved here from md5.h.
(sha1_process_block): Remove a FIXME that doesn't make sense.

Index: lib/md5.c
===
RCS file: /cvsroot/gnulib/gnulib/lib/md5.c,v
retrieving revision 1.19
diff -p -u -r1.19 md5.c
--- lib/md5.c   14 May 2005 06:03:58 -  1.19
+++ lib/md5.c   12 Sep 2005 22:04:54 -
@@ -1,6 +1,6 @@
 /* md5.c - Functions to compute MD5 message digest of files or memory blocks
according to the definition of MD5 in RFC 1321 from April 1992.
-   Copyright (C) 1995, 1996, 2001, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 2001, 2003, 2004, 2005 Free Software Foundation, 
Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library.  Bugs can be reported to [EMAIL PROTECTED]
 
@@ -57,10 +57,8 @@
 #endif
 
 #define BLOCKSIZE 4096
-/* Ensure that BLOCKSIZE is a multiple of 64.  */
 #if BLOCKSIZE % 64 != 0
-/* FIXME-someday (soon?): use #error instead of this kludge.  */
-invalid BLOCKSIZE
+# error invalid BLOCKSIZE
 #endif
 
 /* This array contains the bytes used to pad the buffer to the next
@@ -335,15 +333,22 @@ md5_process_block (const void *buffer, s
 {  \
  a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \
  ++words;  \
- a = rol (a, s);   \
+ CYCLIC (a, s);\
  a += b;   \
 }  \
   while (0)
 
+  /* It is unfortunate that C does not provide an operator for
+cyclic rotation.  Hope the C compiler is smart enough.  */
+#define CYCLIC(w, s) (w = (w  s) | (w  (32 - s)))
+
   /* Before we start, one word to the strange constants.
 They are defined in RFC 1321 as
 
-T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or
+T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
+
+Here is an equivalent invocation using Perl:
+
 perl -e 'foreach(1..64){printf 0x%08x\n, int (4294967296 * abs (sin 
$_))}'
*/
 
@@ -373,7 +378,7 @@ md5_process_block (const void *buffer, s
   do   \
{   \
  a += f (b, c, d) + correct_words[k] + T;  \
- a = rol (a, s);   \
+ CYCLIC (a, s);\
  a += b;   \
}   \
   while (0)
Index: lib/md5.h
===
RCS file: /cvsroot/gnulib/gnulib/lib/md5.h,v
retrieving revision 1.16
diff -p -u -r1.16 md5.h
--- lib/md5.h   14 May 2005 06:03:58 -  1.16
+++ lib/md5.h   12 Sep 2005 22:04:54 -
@@ -1,8 +1,6 @@
-/* md5.h - Declaration of functions and data types used for MD5 sum
-   computing library functions.
-
-   Copyright (C) 1995, 1996, 1999, 2000, 2003, 2004 Free Software
-   Foundation, Inc.
+/* Declaration of functions and data types used for MD5 sum computing
+   library functions.
+   Copyright (C) 1995-1997,1999-2005 Free Software Foundation, Inc.
 
NOTE: The canonical source of this file is maintained with the GNU C
Library.  Bugs can be reported to [EMAIL PROTECTED]
@@ -33,6 +31,39 @@
 # include stdint.h
 #endif
 
+#ifndef __GNUC_PREREQ
+# if defined __GNUC__  defined __GNUC_MINOR__
+#  define __GNUC_PREREQ(maj, min) \
+   ((__GNUC__  16) + __GNUC_MINOR__ = ((maj)  16) + (min))
+# else
+#  define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif
+
+#ifndef __THROW
+# if defined __cplusplus 

Re: mmapping of /dev/zero always fails on darwin

2005-09-12 Thread Derek Price
Peter O'Gorman wrote:

 The test would have to be a run test, which would mean having a
 cross-compile alternative switching on the system name (this is why
 gcc switches on name).


All,

Generally, I choose to be pessimistic about test failures when
cross-compiling.  Anyone have an opinion about whether I should be
pessimistic always or just when the target system name matches gcc's
list of systems which fail this test?

 Hope this helps,


It does.  Thanks Peter.

Regards,

Derek

-- 
Derek R. Price
CVS Solutions Architect
Ximbiot http://ximbiot.com
v: +1 717.579.6168
f: +1 717.234.3125
mailto:[EMAIL PROTECTED]




___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: mmapping of /dev/zero always fails on darwin

2005-09-12 Thread Peter O'Gorman

Derek Price wrote:



I don't suppose you could come up with a configure test or a short C
program that fails to compile (preferrably) or run (if necessary) to
spot this, short of actually switching on the system name or something
similar?


The test would have to be a run test, which would mean having a 
cross-compile alternative switching on the system name (this is why gcc 
switches on name).


Just doing the same thing as gnulib does will show the failure:

int main(){
void * address = NULL;
static int fd =-1;
int ret = 0;
fd = open (/dev/zero,O_RDONLY,666);
ret = mmap (NULL, 4096, PROT_READ | PROT_WRITE, MAP_FILE | 
MAP_PRIVATE, fd, 0);

if (ret != MAP_FAILED) return 0;
return 1;
}

Hope this helps,
Peter


___
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib


Re: glob_.h glibc

2005-09-12 Thread Derek Price
Okay, I've committed the glob-min-glibc-h-changes2.diff patch.  The 
glob.h-glibc-to-gnulib2.diff should be the new minimal patch for submission to 
glibc.


2005-09-12  Derek Price  [EMAIL PROTECTED]
Paul Eggert  [EMAIL PROTECTED]

* modules/glob (Files): Add glob-libc.h.
* lib/glob-libc.h: Renamed from glob_.h.  The new version is
taken from libc's glob.h, except with '#ifdef __GLOB_GNULIB'
protecting things that should be done only in gnulib contexts.
* lib/glob_.h: New file, containing only the glob things needed for
gnulib.
(GLOB_PREFIX): Remove.  All uses changed to look for __GLOB_GNULIB.
(__GLOB_CONCAT, __GLOB_XCONCAT, __GLOB_ID): Remove; no longer needed.
(glob, globfree, glob_pattern_p): Now defined simply in terms of
rpl_glob, rpl_globfree, rpl_glob_pattern_p.
(__GLOB_GNULIB): New macro, to keep the glob.h changes clearer
and to respect the namespace rules better.
* m4/glob.m4 (gl_GLOB_SUBSTITUTE): AC_LIBSOURCES for glob.c,
glob_.h, glob-libc.h.
(gl_PREREQ_GLOB): Remove _SYS_CDEFS_H hack; no longer needed.


2005-09-12  Derek Price  [EMAIL PROTECTED]
Paul Eggert  [EMAIL PROTECTED]

* posix/glob.h: Avoid a header and some largefile support when
compiled as part of GNULIB.

Regards,

Derek

-- 
Derek R. Price
CVS Solutions Architect
Ximbiot http://ximbiot.com
v: +1 717.579.6168
f: +1 717.234.3125
mailto:[EMAIL PROTECTED]

Index: lib/glob-libc.h
===
RCS file: lib/glob-libc.h
diff -N lib/glob-libc.h
--- /dev/null   1 Jan 1970 00:00:00 -
+++ lib/glob-libc.h 13 Sep 2005 03:40:13 -
@@ -0,0 +1,196 @@
+/* Copyright (C) 1991,92,95-98,2000,2001,2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef_GLOB_H
+#define_GLOB_H 1
+
+#ifndef __GLOB_GNULIB
+# include sys/cdefs.h
+#endif
+
+__BEGIN_DECLS
+
+/* We need `size_t' for the following definitions.  */
+#ifndef __size_t
+# if defined __GNUC__  __GNUC__ = 2
+typedef __SIZE_TYPE__ __size_t;
+#  ifdef __USE_XOPEN
+typedef __SIZE_TYPE__ size_t;
+#  endif
+# else
+#  include stddef.h
+#  ifndef __size_t
+#   define __size_t size_t
+#  endif
+# endif
+#else
+/* The GNU CC stddef.h version defines __size_t as empty.  We need a real
+   definition.  */
+# undef __size_t
+# define __size_t size_t
+#endif
+
+/* Bits set in the FLAGS argument to `glob'.  */
+#defineGLOB_ERR(1  0)/* Return on read errors.  */
+#defineGLOB_MARK   (1  1)/* Append a slash to each name.  */
+#defineGLOB_NOSORT (1  2)/* Don't sort the names.  */
+#defineGLOB_DOOFFS (1  3)/* Insert PGLOB-gl_offs NULLs.  */
+#defineGLOB_NOCHECK(1  4)/* If nothing matches, return the 
pattern.  */
+#defineGLOB_APPEND (1  5)/* Append to results of a previous 
call.  */
+#defineGLOB_NOESCAPE   (1  6)/* Backslashes don't quote 
metacharacters.  */
+#defineGLOB_PERIOD (1  7)/* Leading `.' can be matched by 
metachars.  */
+
+#if !defined __USE_POSIX2 || defined __USE_BSD || defined __USE_GNU
+# define GLOB_MAGCHAR   (1  8)/* Set in gl_flags if any metachars seen.  */
+# define GLOB_ALTDIRFUNC (1  9)/* Use gl_opendir et al functions.  */
+# define GLOB_BRACE (1  10)/* Expand {a,b} to a b.  */
+# define GLOB_NOMAGIC   (1  11)/* If no magic chars, return the pattern.  */
+# define GLOB_TILDE (1  12)/* Expand ~user and ~ to home directories. */
+# define GLOB_ONLYDIR   (1  13)/* Match only directories.  */
+# define GLOB_TILDE_CHECK (1  14)/* Like GLOB_TILDE but return an error
+ if the user name is not available.  */
+# define __GLOB_FLAGS  (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
+GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \
+GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \
+GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK)
+#else
+# define __GLOB_FLAGS  (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
+