Re: visibility.m4

2009-11-02 Thread Paolo Bonzini

On 10/31/2009 05:34 PM, Mike Gran wrote:

Hello-

If I use visibility.m4 on a platform with a recent GCC (4.x) on
Cygwin, the visibility.m4 correctly discovers that gcc can compile
with -fvisibility="hidden".  But, on Cygwin (and probably most
non-ELF) gcc does not actualy implement the visibility and emits the
warning "visibility attribute not supported in this configuration"
instead.  Even so, the tests in visibility.m4 pass, and
HAVE_VISIBILITY is set in the affirmative.

In my humble opinion, it would be a good idea to add a "-werror" to
the test in visibility.m4 so that it won't set CFLAGS_VISIBILITY and
HAVE_VISIBILITY on those platforms that don't actually support it.


There is also a more comprehensive test in gcc.  I'll look at it.

Paolo





Re: Explicit interpreter paths considered harmful

2009-11-02 Thread Simon Josefsson
l...@gnu.org (Ludovic Courtès) writes:

> diff --git a/build-aux/pmccabe2html b/build-aux/pmccabe2html
> index 27bb8f3..4fe4c64 100755
> --- a/build-aux/pmccabe2html
> +++ b/build-aux/pmccabe2html
> @@ -1,4 +1,5 @@
> -#!/usr/bin/awk -f
> +#!/bin/sh
> +exec awk -f "$0" "$@"
>  # pmccabe2html - pmccabe to html converter
>  
>  # Copyright (C) 2007, 2008 Free Software Foundation, Inc.
>
> Then I think ‘gl_PMCCABE2HTML’ could be removed altogether, which would
> bring the module on par with the other maintainer-only scripts.
>
> What do you think?

Sounds great, thank you.  Pushed:

http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=c9fed5f857a8a6bcce5e276920fd64c43bc5c668

/Simon




Re: test-utimens.h:105: assertion failed

2009-11-02 Thread Simon Josefsson
Eric Blake  writes:

> According to Simon Josefsson on 10/30/2009 2:32 AM:
>> A (f)utimens test fail on Ubuntu 8.04 LTS:
>
> Thanks for the report.  Which kernel and which version of glibc?  Is it a
> machine I might have access to, like the gcc compile farm?

Send me your SSH public key and preferred username and I'll give you
access to it, it is a virtual Ubuntu 8.04 LTS instance on slicehost.
Info:

Linux gaggia 2.6.24-23-xen #1 SMP Mon Jan 26 03:09:12 UTC 2009 x86_64 GNU/Linux
GNU C Library stable release version 2.7, by Roland McGrath et al.
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.2.4 (Ubuntu 4.2.4-1ubuntu4).
Compiled on a Linux >>2.6.24-23-server<< system on 2009-08-17.
Available extensions:
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
For bug reporting instructions, please see:
.

>> I can't reproduce on current debian testing, so it is likely an old bug.
>
> The Linux man pages are explicit that older kernels had a bug where
> UTIME_OMIT with a non-zero seconds field failed with EINVAL instead of
> working, but I thought my code path already worked around this.  Can you
> check what errno was set to?  Or even better, single-step through
> utimens.c at that point to see why validate_timespec() doesn't seem to be
> doing the trick.

Errno is EINVAL.  I can single-step if the other information in this
e-mail isn't sufficient, let me know.

> Also, an strace run would be invaluable, to see what actual arguments were
> passed to the syscall.

Attached.

/Simon


utimens-strace.txt.gz
Description: Binary data


Re: Build + test problems on OpenSolaris (aka Solaris 11)

2009-11-02 Thread Simon Josefsson
The GnuTLS team received the bug report below, but it appears to be a
gnulib issue.

The problem indicate a sub-optimal approach in gnulib's inet_ntop
module.  It causes link failures due to missing -lnsl on Solaris.  The
m4/inet_ntop.m4 file reads:

  dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to
  dnl find inet_ntop.
  dnl
  dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
  dnl -lnsl if it is needed.  Normally -lnsl is not needed on Solaris 8,
  dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
  dnl isn't built on Solaris 8.
  gl_save_LIBS=$LIBS
  AC_SEARCH_LIBS([inet_ntop], [nsl], [],
[AC_REPLACE_FUNCS([inet_ntop])])
  LIBS=$gl_save_LIBS

In similar situations, other gnulib module provide an variable LIBFOO
that can be used by the application.  Compare m4/sockets.m4 which
provide the LIBSOCKET variable that sometimes evaluates to -lsocket.  I
suggest to do the same in inet_ntop.m4.

How about this patch?  Not tested on Solaris systems, but posted for
review of my general idea.

/Simon

diff --git a/m4/inet_ntop.m4 b/m4/inet_ntop.m4
index 2bbdca1..92a3e7f 100644
--- a/m4/inet_ntop.m4
+++ b/m4/inet_ntop.m4
@@ -17,12 +17,20 @@ AC_DEFUN([gl_INET_NTOP],
   dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
   dnl -lnsl if it is needed.  Normally -lnsl is not needed on Solaris 8,
   dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
-  dnl isn't built on Solaris 8.
+  dnl isn't built on Solaris 8.  The recommended way to do this is to
+  dnl add $(LIBNSL) to the linker parameters when linking
+  dnl applications/libraries that uses inet_ntop.
   gl_save_LIBS=$LIBS
   AC_SEARCH_LIBS([inet_ntop], [nsl], [],
 [AC_REPLACE_FUNCS([inet_ntop])])
   LIBS=$gl_save_LIBS
 
+  LIBNSL=
+  if test "$ac_cv_search_inet_ntop" != "none needed"; then
+LIBNSL="$ac_cv_search_inet_ntop"
+  fi
+  AC_SUBST([LIBNSL])
+
   gl_PREREQ_INET_NTOP
 ])
 
diff --git a/modules/inet_ntop b/modules/inet_ntop
index bf7ab75..b3e278c 100644
--- a/modules/inet_ntop
+++ b/modules/inet_ntop
@@ -19,6 +19,9 @@ gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
 
 Makefile.am:
 
+Link:
+$(LIBNSL)
+
 License:
 LGPLv2+
 

Boyan Kasarov  writes:

> Hello,
>
> This is the build output for the example
>
> gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../..  -I../../lib/includes
> -I../../lib/includes -I../../libextra/includes -I../../gl -I../../gl
> -g -O2 -MT ex-serv-export.o -MD -MP -MF .deps/ex-serv-export.Tpo -c -o
> ex-serv-export.o ex-serv-export.c
> mv -f .deps/ex-serv-export.Tpo .deps/ex-serv-export.Po
> /bin/sh ../../libtool --tag=CC   --mode=link gcc -std=gnu99   -g -O2
> -no-install  -o ex-serv-export ex-serv-export.o
> libexamples.la ../../lib/libgnutls.la ../../libextra/libgnutls-extra.la 
> ../../gl/libgnu.la -lsocket 
>
> libtool: link: gcc -std=gnu99 -g -O2 -o ex-serv-export
> ex-serv-export.o  ./.libs/libexamples.a ../../lib/.libs/libgnutls.so 
> ../../libextra/.libs/libgnutls-extra.so 
> /export/home/derex/workspace/gnutls-2.9.8/lib/.libs/libgnutls.so -ltasn1 -lz 
> -lgcrypt ../../gl/.libs/libgnu.a -lsocket 
> -R/export/home/derex/workspace/gnutls-2.9.8/lib/.libs 
> -R/export/home/derex/workspace/gnutls-2.9.8/libextra/.libs -R/tmp/gnutls/lib
>
> ld: warning:
> file /export/home/derex/workspace/gnutls-2.9.8/lib/.libs/libgnutls.so:
> linked to ../../lib/.libs/libgnutls.so: attempted multiple inclusion of
> file
> Undefined   first referenced
> symbol in file
> inet_ntop   ex-serv-export.o  (symbol belongs to
> implicit dependency /lib/libnsl.so.1)
> ld: fatal: symbol referencing errors. No output written to
> ex-serv-export
>
> On Mon, 2009-11-02 at 11:40 +0100, Simon Josefsson wrote:
>> When you don't use the workaround, what is the value of LIBSOCKET in
>> doc/examples/Makefile?  I think it should contain -lnsl, and should be
>> used when linking ex-serv1.  Can you show the build output?
>
> LIBSOCKET = -lsocket
>
> Boyan




Re: more warnings patrol

2009-11-02 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Eric Blake on 10/30/2009 6:10 PM:
> I'm committing this, to silence some unused variables, and to make
> inttostr.c quiet even on older gcc.

And looking in config.log, I found these.

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

Eric Blake e...@byu.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkru2WUACgkQ84KuGfSFAYB+hQCgqJsq9fEdZcGD9ztChJ1tscBT
vZwAnAmj0U26P4mHFkVCpo49LAYsVNbP
=dTlr
-END PGP SIGNATURE-
>From 6203770684e686597b1b0583663b852d8a3ae241 Mon Sep 17 00:00:00 2001
From: Eric Blake 
Date: Mon, 2 Nov 2009 06:03:20 -0700
Subject: [PATCH] maint: avoid compiler warnings in m4 macros

* m4/ungetc.m4 (gl_FUNC_UNGETC_WORKS): Avoid unused variable.
* m4/rmdir.m4 (gl_FUNC_RMDIR): Include correct header.

Signed-off-by: Eric Blake 
---
 ChangeLog|6 ++
 m4/rmdir.m4  |3 ++-
 m4/ungetc.m4 |4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9761612..d4a4cb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-02  Eric Blake  
+
+   maint: avoid compiler warnings in m4 macros
+   * m4/ungetc.m4 (gl_FUNC_UNGETC_WORKS): Avoid unused variable.
+   * m4/rmdir.m4 (gl_FUNC_RMDIR): Include correct header.
+
 2009-10-30  Eric Blake  

vasnprintf: avoid compiler warnings
diff --git a/m4/rmdir.m4 b/m4/rmdir.m4
index addd69d..599b789 100644
--- a/m4/rmdir.m4
+++ b/m4/rmdir.m4
@@ -1,4 +1,4 @@
-# rmdir.m4 serial 6
+# rmdir.m4 serial 7
 dnl Copyright (C) 2002, 2005, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -30,6 +30,7 @@ AC_DEFUN([gl_FUNC_RMDIR],
  [AC_LANG_PROGRAM(
[[#include 
  #include 
+ #include 
 ]], [[return !rmdir ("conftest.file/") || errno != ENOTDIR
|| !rmdir ("conftest.dir/./");]])],
  [gl_cv_func_rmdir_works=yes], [gl_cv_func_rmdir_works=no],
diff --git a/m4/ungetc.m4 b/m4/ungetc.m4
index 9236d4c..eb65235 100644
--- a/m4/ungetc.m4
+++ b/m4/ungetc.m4
@@ -1,4 +1,4 @@
-# ungetc.m4 serial 1
+# ungetc.m4 serial 2
 dnl Copyright (C) 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,7 +12,7 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS],
 [gl_cv_func_ungetc_works],
 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include 
-  ]], [FILE *f; long l;
+  ]], [FILE *f;
   if (!(f = fopen ("conftest.tmp", "w+"))) return 1;
   if (fputs ("abc", f) < 0) return 2;
   rewind (f);
-- 
1.6.5.rc1



Re: Explicit interpreter paths considered harmful

2009-11-02 Thread Eric Blake
Jim Meyering  meyering.net> writes:

> Rather than putting #!/usr/bin/perl on the first line,
> start with a variant of what's recommended by "man perlrun" that
> invokes the first "perl" program from your shell's search path.

We should change the test to match.  I also ran into a failure on cygwin, where 
apparently the new style creates .bak files (even though we are requesting -i 
without a suffix):

| FAIL: test-update-copyright.sh (exit: 1)
| 
| 
| --- -   2009-11-02 09:04:12.699584300 -0700
| +++ update-copyright.test-ex-stderr 2009-11-02 09:04:12.652715900 -0700
| @@ -1,2 +1,4 @@
|  update-copyright.test-ex.4: warning: FSF copyright statement not found
| +update-copyright.test-ex.4.bak: warning: FSF copyright statement not found
|  update-copyright.test-ex.5: warning: FSF copyright statement not found
| +update-copyright.test-ex.5.bak: warning: FSF copyright statement not found

So here's what I'm thinking of pushing:

>From 4148ce0ef79cd2eb741d2a22c1aa011d10129b2c Mon Sep 17 00:00:00 2001
From: Eric Blake 
Date: Mon, 2 Nov 2009 10:23:33 -0700
Subject: [PATCH] test-update-copyright: update test to match script changes

* tests/test-update-copyright.sh: Avoid hard-coding perl
location.  Don't update *.bak created by earlier runs.

Signed-off-by: Eric Blake 
---
 ChangeLog  |6 ++
 tests/test-update-copyright.sh |   10 +-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9014fcc..bcb47c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-02  Eric Blake  
+
+   test-update-copyright: update test to match script changes
+   * tests/test-update-copyright.sh: Avoid hard-coding perl
+   location.  Don't update *.bak created by earlier runs.
+
 2009-10-30  Eric Blake  

vasnprintf: avoid compiler warnings
diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh
index 24574b2..859c75d 100755
--- a/tests/test-update-copyright.sh
+++ b/tests/test-update-copyright.sh
@@ -32,7 +32,12 @@ trap 'rm -f $TMP_BASE*' 0 1 2 3 15

 TMP=$TMP_BASE
 s=$TMP-script
-printf '#!/usr/bin/perl -pi\ns/a/b/\n' > $s
+cat <<\EOF > $s
+eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
+  & eval 'exec perl -wS -0777 -pi "$0" $argv:q'
+if 0;
+s/a/b/
+EOF
 chmod a+x $s
 echo a > $TMP-in
 ./$s $TMP-in 2>/dev/null && test b = "`cat $TMP-in 2>/dev/null`" ||
@@ -82,6 +87,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Foundation, Inc.
 EOF

+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2009 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
@@ -124,6 +130,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Foundation, Inc.
 EOF

+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
@@ -162,6 +169,7 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
 # Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc.
 EOF

+rm -f $TMP.*.bak
 UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_FORCE=1 \
   update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr
 compare /dev/null $TMP-stdout || exit 1
-- 
1.6.4.2







EAI_NODATA used in test-getaddrinfo.c

2009-11-02 Thread Jim Meyering
On Freebsd8-rc2 I saw this:

  test-getaddrinfo.c: In function 'simple':
  test-getaddrinfo.c:95: error: 'EAI_NODATA' undeclared (first use in this 
function)

lib/netdb.h was not generated.

Here's one way to fix it, but
I haven't dug enough yet to know if that's appropriate:

diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
index 384b98b..57c1a4d 100644
--- a/tests/test-getaddrinfo.c
+++ b/tests/test-getaddrinfo.c
@@ -91,10 +91,12 @@ simple (char const *host, char const *service)
 fail the test merely because of this.  */
   if (res == EAI_SERVICE)
return 0;
+#ifdef EAI_NODATA
   /* AIX reports EAI_NODATA for "https".  Don't fail the test
 merely because of this.  */
   if (res == EAI_NODATA)
return 0;
+#endif
   /* Provide details if errno was set.  */
   if (res == EAI_SYSTEM)
dbgprintf ("system error: %s\n", strerror (err));




4 test failures on freebsd8-rc2

2009-11-02 Thread Jim Meyering
FYI, I haven't looked at all, yet...

==
   GNU coreutils 8.0.79-71c2f8: gnulib-tests/test-suite.log
==

4 of 178 tests failed.  (2 tests were not run).

.. contents:: :depth: 2


FAIL: test-linkat (exit: 134)
=

test-linkat.c:240: assertion failed

FAIL: test-posixtm (exit: 1)


0101.00 mismatch (-: actual; +:expected)
--62167132800
+-62167219200

FAIL: test-rename (exit: 134)
=

test-rename.h:141: assertion failed

FAIL: test-utimens (exit: 134)
==

test-utimens.h:126: assertion failed




Re: EAI_NODATA used in test-getaddrinfo.c

2009-11-02 Thread Bruno Haible
Jim Meyering wrote:
> On Freebsd8-rc2 I saw this:
> 
>   test-getaddrinfo.c: In function 'simple':
>   test-getaddrinfo.c:95: error: 'EAI_NODATA' undeclared (first use in this 
> function)
> 
> lib/netdb.h was not generated.
> 
> Here's one way to fix it, but
> I haven't dug enough yet to know if that's appropriate:
> 
> diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
> index 384b98b..57c1a4d 100644
> --- a/tests/test-getaddrinfo.c
> +++ b/tests/test-getaddrinfo.c
> @@ -91,10 +91,12 @@ simple (char const *host, char const *service)
>fail the test merely because of this.  */
>if (res == EAI_SERVICE)
>   return 0;
> +#ifdef EAI_NODATA
>/* AIX reports EAI_NODATA for "https".  Don't fail the test
>merely because of this.  */
>if (res == EAI_NODATA)
>   return 0;
> +#endif
>/* Provide details if errno was set.  */
>if (res == EAI_SYSTEM)
>   dbgprintf ("system error: %s\n", strerror (err));

Yes, it's the best way to fix this. EAI_NODATA is not mandated by POSIX,
therefore it is OK if gnulib does not override  on this platform.
Hence it's the test which has to be corrected.

Bruno




mkostemps

2009-11-02 Thread Eric Blake
Now that glibc 2.11 offers mkostemps, we should too.  Any objections to this 
patch series?

Eric Blake (3):
  tempname: resync from glibc
This patch conflicts with coreutils' local override of tempname.c, so I'm also 
working on a coreutils followup patch to fix things once coreutils imports the 
latest gnulib, as well as to make mktemp(1) smarter.

  mkstemps, mkostemps: new modules
Pretty much straight out of glibc.

  stdlib-safer: wrap all mkstemp variants
Makes "stdlib--.h" recognize the 2 new variants, as well as mkostemp.


>From 75660128d203fbbcc985635f8fd49ca25bc72fe7 Mon Sep 17 00:00:00 2001
From: Eric Blake 
Date: Mon, 2 Nov 2009 13:19:27 -0700
Subject: [PATCH 1/3] tempname: resync from glibc

* lib/tempname.c (__gen_tempname): Add suffixlen argument.  Use
same values for __GT_FILE as glibc.  Abort even when assertions
are disabled.
* lib/tempname.h (GT_FILE): Use glibc __GT_FILE, if available, and
match its value otherwise.  Allow idempotent inclusion.
* lib/mkdtemp.c (mkdtemp): Adjust caller.
* lib/mkostemp.c (mkostemp): Likewise.
* lib/mkstemp.c (mkstemp): Likewise.
* lib/tmpfile.c (tmpfile): Likewise.
* NEWS: Document this.

Signed-off-by: Eric Blake 
---
 ChangeLog  |   12 
 NEWS   |3 +++
 lib/mkdtemp.c  |2 +-
 lib/mkostemp.c |2 +-
 lib/mkstemp.c  |2 +-
 lib/tempname.c |   30 ++
 lib/tempname.h |   27 ---
 lib/tmpfile.c  |2 +-
 8 files changed, 57 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 786a46c..8103f83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2009-11-02  Eric Blake  

+   tempname: resync from glibc
+   * lib/tempname.c (__gen_tempname): Add suffixlen argument.  Use
+   same values for __GT_FILE as glibc.  Abort even when assertions
+   are disabled.
+   * lib/tempname.h (GT_FILE): Use glibc __GT_FILE, if available, and
+   match its value otherwise.  Allow idempotent inclusion.
+   * lib/mkdtemp.c (mkdtemp): Adjust caller.
+   * lib/mkostemp.c (mkostemp): Likewise.
+   * lib/mkstemp.c (mkstemp): Likewise.
+   * lib/tmpfile.c (tmpfile): Likewise.
+   * NEWS: Document this.
+
mktime, timegm: share common declaration
* lib/mktime-internal.h: New file.
* lib/mktime.c: Use it rather than open-coding a declaration.
diff --git a/NEWS b/NEWS
index 5ae0d78..7a12584 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ User visible incompatible changes

 DateModules Changes

+2009-11-02  tempnameThe gen_tempname function takes an additional
+'suffixlen' argument. You can safely pass 0.
+
 2009-10-10  utimens The use of this module now requires linking with
 $(LIB_CLOCK_GETTIME).

diff --git a/lib/mkdtemp.c b/lib/mkdtemp.c
index b5181d1..7f07ee4 100644
--- a/lib/mkdtemp.c
+++ b/lib/mkdtemp.c
@@ -31,7 +31,7 @@
 char *
 mkdtemp (char *template)
 {
-  if (gen_tempname (template, 0, GT_DIR))
+  if (gen_tempname (template, 0, 0, GT_DIR))
 return NULL;
   else
 return template;
diff --git a/lib/mkostemp.c b/lib/mkostemp.c
index 6b94d40..f8c1acb 100644
--- a/lib/mkostemp.c
+++ b/lib/mkostemp.c
@@ -41,5 +41,5 @@ mkostemp (template, flags)
  char *template;
  int flags;
 {
-  return __gen_tempname (template, flags, __GT_FILE);
+  return __gen_tempname (template, 0, flags, __GT_FILE);
 }
diff --git a/lib/mkstemp.c b/lib/mkstemp.c
index ccf7a7b..0e19251 100644
--- a/lib/mkstemp.c
+++ b/lib/mkstemp.c
@@ -40,5 +40,5 @@ int
 mkstemp (template)
  char *template;
 {
-  return __gen_tempname (template, 0, __GT_FILE);
+  return __gen_tempname (template, 0, 0, __GT_FILE);
 }
diff --git a/lib/tempname.c b/lib/tempname.c
index 4102134..2da5afe 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -40,9 +40,13 @@
 # define TMP_MAX 238328
 #endif
 #ifndef __GT_FILE
-# define __GT_FILE 1
-# define __GT_DIR  2
-# define __GT_NOCREATE 3
+# define __GT_FILE 0
+# define __GT_DIR  1
+# define __GT_NOCREATE 2
+#endif
+#if !_LIBC && (GT_FILE != __GT_FILE || GT_DIR != __GT_DIR   \
+   || GT_NOCREATE != __GT_NOCREATE)
+# error report this to bug-gnulib@gnu.org
 #endif

 #include 
@@ -60,11 +64,12 @@
 # define struct_stat64 struct stat64
 #else
 # define struct_stat64 struct stat
-# define __open open
 # define __gen_tempname gen_tempname
 # define __getpid getpid
 # define __gettimeofday gettimeofday
 # define __mkdir mkdir
+# define __open open
+# define __open64 open
 # define __lxstat64(version, file, buf) lstat (file, buf)
 # define __xstat64(version, file, buf) stat (file, buf)
 #endif
@@ -179,9 +184,9 @@ static const char letters[] =
 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

 /* Generate a temporary file name based on TMPL.  TMPL must match the
-   rules for mk[s]temp (i.e. end in "XX").  The name constructed
-   does not exist at the time of the c

Re: Build + test problems on OpenSolaris (aka Solaris 11)

2009-11-02 Thread Bruno Haible
Simon Josefsson wrote:
> The problem indicate a sub-optimal approach in gnulib's inet_ntop
> module.  It causes link failures due to missing -lnsl on Solaris.

Indeed, Paul Eggert was already aware of it; see his ChangeLog entry in [1].

[1] http://lists.gnu.org/archive/html/bug-gnulib/2009-04/msg00080.html

> How about this patch?  Not tested on Solaris systems, but posted for
> review of my general idea.

It's the right approach. But the name of the variable is not well chosen:
There are several functions defined in libnsl, therefore several modules
may want to define LIBNSL to nonempty when the particular function needs
to be pulled in from libnsl. These variables would clash.

I'm committing the following:


2009-11-02  Simon Josefsson  
Bruno Haible  

* m4/inet_ntop.m4 (gl_INET_NTOP): Define also INET_NTOP_LIB.
* modules/inet_ntop (Link): New section.
Reported by Boyan Kasarov .

--- m4/inet_ntop.m4.orig2009-11-03 00:45:54.0 +0100
+++ m4/inet_ntop.m4 2009-11-03 00:45:00.0 +0100
@@ -1,4 +1,4 @@
-# inet_ntop.m4 serial 9
+# inet_ntop.m4 serial 10
 dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,17 +11,17 @@
 
   gl_REPLACE_ARPA_INET_H
 
-  dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to
-  dnl find inet_ntop.
-  dnl
-  dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
-  dnl -lnsl if it is needed.  Normally -lnsl is not needed on Solaris 8,
-  dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
-  dnl isn't built on Solaris 8.
+  dnl Most platforms that provide inet_ntop define it in libc.
+  dnl Solaris 8..10 provide inet_ntop in libnsl instead.
   gl_save_LIBS=$LIBS
   AC_SEARCH_LIBS([inet_ntop], [nsl], [],
 [AC_REPLACE_FUNCS([inet_ntop])])
   LIBS=$gl_save_LIBS
+  INET_NTOP_LIB=
+  if test "$ac_cv_search_inet_ntop" != "none needed"; then
+INET_NTOP_LIB="$ac_cv_search_inet_ntop"
+  fi
+  AC_SUBST([INET_NTOP_LIB])
 
   gl_PREREQ_INET_NTOP
 ])
--- modules/inet_ntop.orig  2009-11-03 00:45:54.0 +0100
+++ modules/inet_ntop   2009-11-03 00:40:45.0 +0100
@@ -25,5 +25,8 @@
 Include:
 
 
+Link:
+$(INET_NTOP_LIB)
+
 Maintainer:
 Yoann Vandoorselaere, glibc




Re: Solaris and inet_pton

2009-11-02 Thread Bruno Haible
> 2009-11-02  Simon Josefsson  
> Bruno Haible  
> 
>   * m4/inet_ntop.m4 (gl_INET_NTOP): Define also INET_NTOP_LIB.
>   * modules/inet_ntop (Link): New section.
>   Reported by Boyan Kasarov .

The same problem exists also for the inet_pton module. I'm integrating Paul's
and your ideas, like this:


2009-11-02  Paul Eggert  
Simon Josefsson  
Bruno Haible  

Fix link error on Solaris 8.
* m4/inet_pton.m4 (gl_INET_PTON): Search for the function inet_pton
also in libnsl. Define also INET_PTON_LIB.
* modules/inet_pton (Link): New section.

--- m4/inet_pton.m4.orig2009-11-03 00:59:42.0 +0100
+++ m4/inet_pton.m4 2009-11-03 00:59:20.0 +0100
@@ -1,4 +1,4 @@
-# inet_pton.m4 serial 7
+# inet_pton.m4 serial 8
 dnl Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,7 +11,18 @@
 
   gl_REPLACE_ARPA_INET_H
 
-  AC_REPLACE_FUNCS([inet_pton])
+  dnl Most platforms that provide inet_pton define it in libc.
+  dnl Solaris 8..10 provide inet_pton in libnsl instead.
+  gl_save_LIBS=$LIBS
+  AC_SEARCH_LIBS([inet_pton], [nsl], [],
+[AC_REPLACE_FUNCS([inet_pton])])
+  LIBS=$gl_save_LIBS
+  INET_PTON_LIB=
+  if test "$ac_cv_search_inet_pton" != "none needed"; then
+INET_PTON_LIB="$ac_cv_search_inet_pton"
+  fi
+  AC_SUBST([INET_PTON_LIB])
+
   gl_PREREQ_INET_PTON
 ])
 
--- modules/inet_pton.orig  2009-11-03 00:59:42.0 +0100
+++ modules/inet_pton   2009-11-03 00:57:26.0 +0100
@@ -26,5 +26,8 @@
 Include:
 
 
+Link:
+$(INET_PTON_LIB)
+
 Maintainer:
 Simon Josefsson, glibc




Re: test-utimens.h:105: assertion failed

2009-11-02 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Simon Josefsson on 11/2/2009 4:04 AM:
>>> I can't reproduce on current debian testing, so it is likely an old bug.
>> The Linux man pages are explicit that older kernels had a bug where
>> UTIME_OMIT with a non-zero seconds field failed with EINVAL instead of
>> working, but I thought my code path already worked around this.
> 
> Errno is EINVAL.  I can single-step if the other information in this
> e-mail isn't sufficient, let me know.
> 
>> Also, an strace run would be invaluable, to see what actual arguments were
>> passed to the syscall.
> 
> Attached.

And it only lists syscall_280.  Not very helpful - it means strace is so
old that it doesn't recognize the utimensat syscall or how to display its
arguments.  I'm starting to think, however, that this probably means there
was a time when utimesnat existed but did not support UTIME_OMIT (whereas
the current code only works around the problem where utimensat exists and
knows about UTIME_OMIT but rejects non-zero seconds).  If I'm right (and
single stepping through it once I get access to the machine will let me
know), then I can work around it in the same way we implement UTIME_OMIT
for futimesat (where UTIME_OMIT has never been supported).

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

Eric Blake e...@byu.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrvpA8ACgkQ84KuGfSFAYBJCgCfZ7wsag49bCpkRvuF9cwIbGZE
YycAoIBaqawW9GH9trl+Pg5QELyyNd+v
=/Kz0
-END PGP SIGNATURE-




Re: 4 test failures on freebsd8-rc2

2009-11-02 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Jim Meyering on 11/2/2009 2:18 PM:
> test-linkat.c:240: assertion failed
...
> test-utimens.h:126: assertion failed

These two failures look similar, in that they are both instances of the
BSD kernel mistakenly succeeding when handed a symlink to a non-directory
coupled with a trailing slash.  It's not quite the same failure scenario
as Solaris 9, but the workaround is similar.  So I'm hoping that all I
have to do is update the .m4 tests to detect the bug, and that the
existing Solaris 9 code will take care of the rest.

> 
> FAIL: test-posixtm (exit: 1)
> 
> 
> 0101.00 mismatch (-: actual; +:expected)
> --62167132800
> +-62167219200

No idea.  I haven't played with posixtm much.

> 
> test-rename.h:141: assertion failed

Looks like a case of BSD returning a non-standard errno, but where it is
easier to teach the test one more errno to allow than to wrap the BSD bug.
 Now, if only I knew which errno to ignore...

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

Eric Blake e...@byu.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrvpXoACgkQ84KuGfSFAYBsVgCfeWxzQOf/EDXdtstP2hOMam9R
LV0AoMH0YE1yt/8fjH3RdmCICF/I7Zd6
=4Jup
-END PGP SIGNATURE-




Re: more warnings patrol

2009-11-02 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Eric Blake on 10/30/2009 6:52 PM:
>> How about moving this declaration to a new file mktime-internal.h?
> 
> And share it between the mktime and timegm modules.  Yes, that sounds nice.

Done.

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

Eric Blake e...@byu.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrvskIACgkQ84KuGfSFAYBPigCgm6b3ClOTohj45rJ1PfbdEj8L
yO0AoNUlP/KpEJpsirRO9Ca8MU1GRysa
=4emS
-END PGP SIGNATURE-
From c69650b6a6e7e183d6786e40f347d5ac960f7ef9 Mon Sep 17 00:00:00 2001
From: Eric Blake 
Date: Mon, 2 Nov 2009 11:39:38 -0700
Subject: [PATCH] mktime, timegm: share common declaration

* lib/mktime-internal.h: New file.
* lib/mktime.c: Use it rather than open-coding a declaration.
* lib/timegm.c: Likewise.
* modules/mktime (Files): Ship it.
* modules/timegm (Files): Likewise.
Suggested by Bruno Haible.

Signed-off-by: Eric Blake 
---
 ChangeLog |   10 ++
 lib/mktime-internal.h |4 
 lib/mktime.c  |4 +---
 lib/timegm.c  |6 ++
 modules/mktime|1 +
 modules/timegm|1 +
 6 files changed, 19 insertions(+), 7 deletions(-)
 create mode 100644 lib/mktime-internal.h

diff --git a/ChangeLog b/ChangeLog
index ebbf68f..f457a2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2009-11-02  Eric Blake  

+   mktime, timegm: share common declaration
+   * lib/mktime-internal.h: New file.
+   * lib/mktime.c: Use it rather than open-coding a declaration.
+   * lib/timegm.c: Likewise.
+   * modules/mktime (Files): Ship it.
+   * modules/timegm (Files): Likewise.
+   Suggested by Bruno Haible.
+
+2009-11-02  Eric Blake  
+
test-update-copyright: update test to match script changes
* tests/test-update-copyright.sh: Avoid hard-coding perl
location.  Don't update *.bak created by earlier runs.
diff --git a/lib/mktime-internal.h b/lib/mktime-internal.h
new file mode 100644
index 000..4287acf
--- /dev/null
+++ b/lib/mktime-internal.h
@@ -0,0 +1,4 @@
+#include 
+time_t mktime_internal (struct tm *,
+struct tm * (*) (time_t const *, struct tm *),
+time_t *);
diff --git a/lib/mktime.c b/lib/mktime.c
index 8690329..b9b961f 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -147,9 +147,7 @@ const unsigned short int __mon_yday[2][13] =
 # undef __localtime_r
 # define __localtime_r localtime_r
 # define __mktime_internal mktime_internal
-time_t __mktime_internal (struct tm *,
- struct tm * (*) (time_t const *, struct tm *),
- time_t *);
+# include "mktime-internal.h"
 #endif

 /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
diff --git a/lib/timegm.c b/lib/timegm.c
index 67230cf..94d3fa0 100644
--- a/lib/timegm.c
+++ b/lib/timegm.c
@@ -1,6 +1,6 @@
 /* Convert UTC calendar time to simple time.  Like mktime but assumes UTC.

-   Copyright (C) 1994, 1997, 2003, 2004, 2006, 2007 Free Software
+   Copyright (C) 1994, 1997, 2003, 2004, 2006, 2007, 2009 Free Software
Foundation, Inc.  This file is part of the GNU C Library.

This program is free software; you can redistribute it and/or modify
@@ -27,9 +27,7 @@
 # undef __gmtime_r
 # define __gmtime_r gmtime_r
 # define __mktime_internal mktime_internal
-time_t __mktime_internal (struct tm *,
- struct tm * (*) (time_t const *, struct tm *),
- time_t *);
+# include "mktime-internal.h"
 #endif

 time_t
diff --git a/modules/mktime b/modules/mktime
index 7a5165b..037f4e4 100644
--- a/modules/mktime
+++ b/modules/mktime
@@ -2,6 +2,7 @@ Description:
 mktime() function: convert broken-down time to linear time.

 Files:
+lib/mktime-internal.h
 lib/mktime.c
 m4/mktime.m4

diff --git a/modules/timegm b/modules/timegm
index 27eab44..f1de726 100644
--- a/modules/timegm
+++ b/modules/timegm
@@ -2,6 +2,7 @@ Description:
 Convert calendar time to simple time, inverse of mktime.

 Files:
+lib/mktime-internal.h
 lib/timegm.c
 m4/timegm.m4

-- 
1.6.5.rc1



Re: EAI_NODATA used in test-getaddrinfo.c

2009-11-02 Thread Simon Josefsson
Bruno Haible  writes:

> Jim Meyering wrote:
>> On Freebsd8-rc2 I saw this:
>> 
>>   test-getaddrinfo.c: In function 'simple':
>>   test-getaddrinfo.c:95: error: 'EAI_NODATA' undeclared (first use in this 
>> function)
>> 
>> lib/netdb.h was not generated.
>> 
>> Here's one way to fix it, but
>> I haven't dug enough yet to know if that's appropriate:
>> 
>> diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
>> index 384b98b..57c1a4d 100644
>> --- a/tests/test-getaddrinfo.c
>> +++ b/tests/test-getaddrinfo.c
>> @@ -91,10 +91,12 @@ simple (char const *host, char const *service)
>>   fail the test merely because of this.  */
>>if (res == EAI_SERVICE)
>>  return 0;
>> +#ifdef EAI_NODATA
>>/* AIX reports EAI_NODATA for "https".  Don't fail the test
>>   merely because of this.  */
>>if (res == EAI_NODATA)
>>  return 0;
>> +#endif
>>/* Provide details if errno was set.  */
>>if (res == EAI_SYSTEM)
>>  dbgprintf ("system error: %s\n", strerror (err));
>
> Yes, it's the best way to fix this. EAI_NODATA is not mandated by POSIX,
> therefore it is OK if gnulib does not override  on this platform.
> Hence it's the test which has to be corrected.

Fine with me, please push it.  Thanks, Jim.

/Simon




Re: Build + test problems on OpenSolaris (aka Solaris 11)

2009-11-02 Thread Simon Josefsson
Bruno Haible  writes:

>> How about this patch?  Not tested on Solaris systems, but posted for
>> review of my general idea.
>
> It's the right approach. But the name of the variable is not well chosen:
> There are several functions defined in libnsl, therefore several modules
> may want to define LIBNSL to nonempty when the particular function needs
> to be pulled in from libnsl. These variables would clash.
>
> I'm committing the following:

Fine to me, thanks.

/Simon




Re: EAI_NODATA used in test-getaddrinfo.c

2009-11-02 Thread Jim Meyering
Simon Josefsson wrote:

> Bruno Haible  writes:
>
>> Jim Meyering wrote:
>>> On Freebsd8-rc2 I saw this:
>>>
>>>   test-getaddrinfo.c: In function 'simple':
>>>   test-getaddrinfo.c:95: error: 'EAI_NODATA' undeclared (first use in this 
>>> function)
>>>
>>> lib/netdb.h was not generated.
>>>
>>> Here's one way to fix it, but
>>> I haven't dug enough yet to know if that's appropriate:
>>>
>>> diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
>>> index 384b98b..57c1a4d 100644
>>> --- a/tests/test-getaddrinfo.c
>>> +++ b/tests/test-getaddrinfo.c
>>> @@ -91,10 +91,12 @@ simple (char const *host, char const *service)
>>>  fail the test merely because of this.  */
>>>if (res == EAI_SERVICE)
>>> return 0;
>>> +#ifdef EAI_NODATA
>>>/* AIX reports EAI_NODATA for "https".  Don't fail the test
>>>  merely because of this.  */
>>>if (res == EAI_NODATA)
>>> return 0;
>>> +#endif
>>>/* Provide details if errno was set.  */
>>>if (res == EAI_SYSTEM)
>>> dbgprintf ("system error: %s\n", strerror (err));
>>
>> Yes, it's the best way to fix this. EAI_NODATA is not mandated by POSIX,
>> therefore it is OK if gnulib does not override  on this platform.
>> Hence it's the test which has to be corrected.
>
> Fine with me, please push it.  Thanks, Jim.

Pushed.
FYI, it was FreeBSD 7.2, not Freebsd8-rc2:

>From 70c49dd70b22a27ad27e89ee6159aa2daba396f0 Mon Sep 17 00:00:00 2001
From: Jim Meyering 
Date: Tue, 3 Nov 2009 08:53:23 +0100
Subject: [PATCH] test-getaddrinfo: avoid compilation failure on FreeBSD 7.2

* tests/test-getaddrinfo.c (simple): Test for EAI_NODATA only
if it is defined.
---
 ChangeLog|6 ++
 tests/test-getaddrinfo.c |2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3dfebc5..239ec70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-03  Jim Meyering  
+
+   test-getaddrinfo: avoid compilation failure on FreeBSD 7.2
+   * tests/test-getaddrinfo.c (simple): Test for EAI_NODATA only
+   if it is defined.
+
 2009-11-02  Eric Blake  

mktime, timegm: share common declaration
diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
index 384b98b..57c1a4d 100644
--- a/tests/test-getaddrinfo.c
+++ b/tests/test-getaddrinfo.c
@@ -91,10 +91,12 @@ simple (char const *host, char const *service)
 fail the test merely because of this.  */
   if (res == EAI_SERVICE)
return 0;
+#ifdef EAI_NODATA
   /* AIX reports EAI_NODATA for "https".  Don't fail the test
 merely because of this.  */
   if (res == EAI_NODATA)
return 0;
+#endif
   /* Provide details if errno was set.  */
   if (res == EAI_SYSTEM)
dbgprintf ("system error: %s\n", strerror (err));
--
1.6.5.2.292.g1cda2