bootstrap: allow more than one submodule

2010-03-14 Thread Bruno Haible
Hi Eric,

As I understand it, 'bootstrap' currently updates all submodules when it
wants to update only the gnulib submodule. What about packages that will have
other submodules? Here is a proposed fix:


2010-03-14  Bruno Haible  

* build-aux/bootstrap: Apply "git submodule" commands only to the
gnulib submodule.

--- build-aux/bootstrap.origSun Mar 14 14:10:16 2010
+++ build-aux/bootstrap Sun Mar 14 14:01:58 2010
@@ -416,8 +416,8 @@
 -)
   if git_modules_config submodule.gnulib.url >/dev/null; then
 echo "$0: getting gnulib files..."
-git submodule init || exit $?
-git submodule update || exit $?
+git submodule init "$gnulib_path" || exit $?
+git submodule update "$gnulib_path" || exit $?
 
   elif [ ! -d "$gnulib_path" ]; then
 echo "$0: getting gnulib files..."
@@ -445,13 +445,14 @@
   # This fallback allows at least git 1.5.5.
   if test -f "$gnulib_path"/gnulib-tool; then
 # Since file already exists, assume submodule init already complete.
-git submodule update || exit $?
+git submodule update "$gnulib_path" || exit $?
   else
 # Older git can't clone into an empty directory.
 rmdir "$gnulib_path" 2>/dev/null
 git clone --reference "$GNULIB_SRCDIR" \
   "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
-  && git submodule init && git submodule update \
+  && git submodule init "$gnulib_path" \
+  && git submodule update "$gnulib_path" \
   || exit $?
   fi
 fi




Re: bootstrap and git submodules

2010-03-14 Thread Bruno Haible
Hi Jim and Eric,

Thanks for your explanations how 'bootstrap' is to be used with git. But
I still don't find the current state reasonable, because:

  * There are five use cases of the 'bootstrap' script:
  1) A normal user who wants to check out coreutils with the version
 of gnulib with which it was tested. Does not want to be bothered
 with versions, what gnulib is in the first place, etc.
  2) Like 1), but the user knows what gnulib is and has a copy of it
 on his disk.
  3) An expert user who wants to check out the latest gnulib,
 regardless what it contains. He is prepared to report errors.
  4) Like 2), and he has a copy of gnulib on his disk.
  5) An expert user who wants to use his modified version of gnulib.

Most users are in case 1), therefore this has to be the default.

The option --gnulib-srcdir was for use case 5 in the past, IIRC. Now it
is for use case 2, says Jim. So, the cases 3, 4, 5 are not made easy
by 'bootstrap'.

  * I was in case 5, you are telling me to use git commands - and not the
most simple ones - in order to combine source with source. This means,
the git submodule support is getting in the way. It is like if I wanted
to do "make" after having modified a source code file, I would be required
to do "cvs admin" or some such.

So, I think 'bootstrap' needs 3 command line options:
  - One option for choosing use case 3. I propose --gnulib-newest.
  - One option for choosing use cases 2 or 4, from 1 or 3. I propose to call
it --gnulib-repodir.
  - One option for choosing use case 5. The name --gnulib-srcdir seems to be
the right one for this. (As it was before 2008.)

Here is a proposed patch. Tested in all five cases.


2010-03-14  Bruno Haible  

bootstrap: Support more use cases.
* build-aux/bootstrap: New options --gnulib-repodir, --gnulib-newest.
If --gnulib-srcdir is specified, use it directly. Otherwise rely on the
options --gnulib-repodir and --gnulib-newest.
(usage): Rename --gnulib-srcdir to --gnulib-repodir. Document new
options --gnulib-newest, --gnulib-srcdir.

*** build-aux/bootstrap.origSun Mar 14 14:46:43 2010
--- build-aux/bootstrap Sun Mar 14 14:38:11 2010
***
*** 49,63 
  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.  Defaults to \$GNULIB_SRCDIR.
!  --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.
  
  If the file $0.conf exists in the same directory as this script, its
  contents are read as shell variables to configure the bootstrap.
--- 49,75 
  Bootstrap this package from the checked-out sources.
  
  Options:
!   --gnulib-repodir=DIRNAME  Specify the local directory with a recent gnulib
! checkout.  Use this if you already have gnulib
! sources on your machine, and do not want to waste
! your bandwidth downloading them again.
! Defaults to \$GNULIB_REPODIR.
!   --gnulib-newest   Specify to use the newest available gnulib 
revision
! instead of the one that this package was tested
! with.  Use this if you expect to have some bug
! fixed through the newer gnulib version, and are
! prepared to analyze or report problems, should 
they
! occur.
!   --gnulib-srcdir=DIRNAME   Specify the local directory where gnulib sources
! reside.  The options --gnulib-repodir and
! --gnulib-newest are ignored in this case.  Use 
this
! if you want to test against a specific gnulib
! revision, possibly with commits or uncommitted
! changes of yours.
!   --copyCopy files instead of creating symbolic links.
!   --force   Attempt to bootstrap even if the sources seem not
! to have been checked out.
!   --skip-po Do not download po files.
  
  If the file $0.conf exists in the same directory as this script, its
  contents are read as shell variables to configure the bootstrap.
***
*** 226,231 
--- 238,247 
--help)
  usage
  exit;;
+   --gnulib-repodir=*)
+ GNULIB_REPOD

Re: [PATCH] (x)memcoll: performance improvement when input is known to be NUL delimited.

2010-03-14 Thread Bruno Haible
Hi Chen,

> > It would be good to start the function with a safety check:
> > 
> >  if (!(s1len > 0 && s1[s1len - 1] == '\0'))
> >abort ();
> >  if (!(s2len > 0 && s2[s2len - 1] == '\0'))
> >abort ();
> 
> If the whole point was performance, but we introduce 4 conditional
> branches, that may more than cancel out any speedups we gain.
>
> For an extreme example, memcoll isn't threadsafe, but there isn't a
> safety check of locking down the strings before writing a NUL byte to
> the end.
> 
> Could we just document it clearly that the (x)memcoll0 functions
> absolutely require both S1 and S2 to be NUL delimited, and thus
> leave it up to the user to know the usage?

Correct execution of a program is more important than its speed. My
math teacher used to say, when talking about the floating-point operations
of the CDC Cyber computers he used: "This computer produces wrong results,
but it does so very fast." (These float operations were not IEEE compliant.
They implemented round-towards-zero for each operation, not round-to-even.
Thus rounding errors accumulated in one direction.)

Safety checks reduce the probability of incorrect programming. If the
probability that a programmer mis-uses an API is 10%, leading to incorrect
results, is it not worth spending 1% of execution time to avoid this?

Here, the calling convention of providing a string with a size, and the
size must include the trailing NUL byte, is so unusual that the probability
of a mis-use of the API is likely 10% or more.

About safety checks against multithread-related programming errors: In C
this is not possible, because there is no direct relation between locks
and locked objects in memory, but in programming languages where it is
possible, it is being successfully done. In Java, for example, when one
thread iterates over a hash table and another thread modifies it at the
same time, you get an exception. I've seen such exceptions numerous times.
Given that each such check is an O(1) operation - just a few instructions -,
it is certainly worth it.

Bruno




Re: [PATCH] (x)memcoll: performance improvement when input is known to be NUL delimited.

2010-03-14 Thread Bruno Haible
Hi Chen,

> ... it was consistently (as in every run for 20 runs) faster, and thus I've
> included it in the patch. 

Thanks. I'll wait for the FSF notification that the legal papers have arrived.

> This is not what I expected at all, and I'm having a hard time coming up with
> a reason why this is

15 years ago, on a Linux/x86 machine, I could measure CPU performance with
about 1% precision (with 3 or 5 runs of a program). At the same time, on
Windows, I got only about 5% precision.

On SPARC CPUs, sometimes the same program was 30% slower than the previous day.
So, such platforms were unusable for benchmarking.

Today, x86 CPUs have additional complexity: multiple CPU cores that fight over
the memory bus; hyperthreads. The Linux memory management has become more
complex as well (the kernel actively swapping out some pages). Sometimes you're
even running inside a virtual machine. I usually can get only about 2% of
precision nowadays.

Bruno




Re: lib-ignore: link error with Sun C++ compiler

2010-03-14 Thread Bruno Haible
Ralf Wildenhues wrote:
> > The reason is that the flag -Wl,-z,ignore is accepted by the C compiler 
> > (cc), but
> > leads to an error with the C++ compiler (CC).
> 
> Sun CC needs '-Qoption ld ' as prefix to linker flags (mind the trailing
> space) rather than '-Wl,'.

Thanks for this info.

So, a possible first step is to update the comments in lib-ignore.m4, like in
the proposed patch below.

But this does not fix the problem with coreutils, as long as it has some source
files in C++. I would therefore find it useful to change lib-ignore.m4 so that
it sets an AC_SUBSTed variable IGNORE_UNUSED_LIBS, and coreutils/Makefile.am
can then do
  AM_LDFLAGS = $(IGNORE_UNUSED_LIBS)

What do you think?

Bruno


2010-03-14  Bruno Haible  

* m4/lib-ignore.m4 (gl_IGNORE_UNUSED_LIBRARIES): Add comments.

--- m4/lib-ignore.m4.orig   Sun Mar 14 17:06:37 2010
+++ m4/lib-ignore.m4Sun Mar 14 16:20:31 2010
@@ -9,6 +9,30 @@
 
 AC_DEFUN([gl_IGNORE_UNUSED_LIBRARIES],
 [
+  # Determines the option to be passed to the C compiler, so that it
+  # omits unused libraries.
+  # Example (on Solaris):
+  # $ cc foo.c -lnsl; ldd ./a.out
+  # libnsl.so.1 =>   /lib/libnsl.so.1
+  # libc.so.1 => /lib/libc.so.1
+  # libmp.so.2 =>/lib/libmp.so.2
+  # libmd.so.1 =>/lib/libmd.so.1
+  # libscf.so.1 =>   /lib/libscf.so.1
+  # libdoor.so.1 =>  /lib/libdoor.so.1
+  # libuutil.so.1 => /lib/libuutil.so.1
+  # libgen.so.1 =>   /lib/libgen.so.1
+  # libm.so.2 => /lib/libm.so.2
+  # $ cc foo.c -lnsl -Wl,-z,ignore; ldd ./a.out
+  # libc.so.1 => /lib/libc.so.1
+  # libm.so.2 => /lib/libm.so.2
+
+  # Note that the options works only for the C compiler, not for the C++
+  # compiler:
+  # - Sun C likes '-Wl,-z,ignore'. '-Qoption ld -z,ignore' is not accepted.
+  #   '-z ignore' is accepted but has no effect.
+  # - Sun C++ likes '-Qoption ld -z,ignore'. '-Wl,-z,ignore' is not accepted.
+  #   '-z ignore' is accepted but has no effect.
+
   AC_CACHE_CHECK([for flag to ignore unused libraries],
 [gl_cv_ignore_unused_libraries],
 [gl_cv_ignore_unused_libraries=none
@@ -21,7 +45,7 @@
  # to forestall problems with linkers that have -z, -i, -g, -n, etc. flags.
  # GCC + binutils likes '-Wl,--as-needed'.
  # GCC + Solaris ld likes '-Wl,-z,ignore'.
- # Sun C likes '-z ignore'.
+ # Sun C likes '-Wl,-z,ignore'. '-z ignore' is accepted but has no effect.
  # Don't try bare '--as-needed'; nothing likes it and the HP-UX 11.11
  # native cc issues annoying warnings and then ignores it,
  # which would cause us to incorrectly conclude that it worked.
@@ -38,6 +62,8 @@
  done
  LIBS=$gl_saved_libs])
 
+  # Note that adding this options to LDFLAGS unconditionally does not work in
+  # projects that are partially in C++.
   test "$gl_cv_ignore_unused_libraries" != none &&
 LDFLAGS="$LDFLAGS $gl_cv_ignore_unused_libraries"
 ])




Re: LONG_LONG_MIN

2010-03-14 Thread Bruno Haible
Jim Meyering wrote:
> Which macros from  would be better?

I was thinking of INT64_MIN, INT64_MAX, UINT64_MAX. But using these would
assume that 'long long' has 64 bits, which is not future-proof...

> Using LLONG_MIN etc. sounds fine.

OK, I'm using this. If on some platforms, LLONG_MIN is undefined, it
will get reported, and we'll find some replacement. (Remember that
LONG_LONG_MIN as a fallback is only available with GCC, AFAICS.)


2010-03-14  Bruno Haible  

Fix compilation error with Sun C.
* lib/strtol.c: Use LLONG_MIN instead of GCC specific LONG_LONG_MIN.
Use LLONG_MAX instead of GCC specific LONG_LONG_MAX. Use ULLONG_MAX
instead of GCC specific ULONG_LONG_MAX.
* lib/xstrtoll.c: Likewise.
* lib/xstrtoull.c: Likewise.

--- lib/strtol.c.orig   Sun Mar 14 19:20:28 2010
+++ lib/strtol.cSun Mar 14 17:15:07 2010
@@ -114,9 +114,9 @@
operating on `long long int's.  */
 #ifdef QUAD
 # define LONG long long
-# define STRTOL_LONG_MIN LONG_LONG_MIN
-# define STRTOL_LONG_MAX LONG_LONG_MAX
-# define STRTOL_ULONG_MAX ULONG_LONG_MAX
+# define STRTOL_LONG_MIN LLONG_MIN
+# define STRTOL_LONG_MAX LLONG_MAX
+# define STRTOL_ULONG_MAX ULLONG_MAX
 
 /* The extra casts in the following macros work around compiler bugs,
e.g., in Cray C 5.0.3.0.  */
@@ -147,19 +147,19 @@
  ? (t) -1 \
  : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1
 
-# ifndef ULONG_LONG_MAX
-#  define ULONG_LONG_MAX TYPE_MAXIMUM (unsigned long long)
+# ifndef ULLONG_MAX
+#  define ULLONG_MAX TYPE_MAXIMUM (unsigned long long)
 # endif
-# ifndef LONG_LONG_MAX
-#  define LONG_LONG_MAX TYPE_MAXIMUM (long long int)
+# ifndef LLONG_MAX
+#  define LLONG_MAX TYPE_MAXIMUM (long long int)
 # endif
-# ifndef LONG_LONG_MIN
-#  define LONG_LONG_MIN TYPE_MINIMUM (long long int)
+# ifndef LLONG_MIN
+#  define LLONG_MIN TYPE_MINIMUM (long long int)
 # endif
 
 # if __GNUC__ == 2 && __GNUC_MINOR__ < 7
/* Work around gcc bug with using this constant.  */
-   static const unsigned long long int maxquad = ULONG_LONG_MAX;
+   static const unsigned long long int maxquad = ULLONG_MAX;
 #  undef STRTOL_ULONG_MAX
 #  define STRTOL_ULONG_MAX maxquad
 # endif
--- lib/xstrtoll.c.orig Sun Mar 14 19:20:28 2010
+++ lib/xstrtoll.c  Sun Mar 14 17:15:08 2010
@@ -1,6 +1,6 @@
 #define __strtol strtoll
 #define __strtol_t long long int
 #define __xstrtol xstrtoll
-#define STRTOL_T_MINIMUM LONG_LONG_MIN
-#define STRTOL_T_MAXIMUM LONG_LONG_MAX
+#define STRTOL_T_MINIMUM LLONG_MIN
+#define STRTOL_T_MAXIMUM LLONG_MAX
 #include "xstrtol.c"
--- lib/xstrtoull.c.origSun Mar 14 19:20:28 2010
+++ lib/xstrtoull.c Sun Mar 14 17:15:08 2010
@@ -2,5 +2,5 @@
 #define __strtol_t unsigned long long int
 #define __xstrtol xstrtoull
 #define STRTOL_T_MINIMUM 0
-#define STRTOL_T_MAXIMUM ULONG_LONG_MAX
+#define STRTOL_T_MAXIMUM ULLONG_MAX
 #include "xstrtol.c"




time_r fix

2010-03-14 Thread Bruno Haible
Compiling a testdir for 'time' on mingw, I see this error:

../gllib/time.h:379: error: `::localtime_r' has not been declared
../gllib/time.h:394: error: `::gmtime_r' has not been declared

This fixes it.


2010-03-14  Bruno Haible  

Fix compilation error on mingw when module 'time_r' is not used.
* lib/time.in.h (localtime_r, gmtime_r): Declare only if GNULIB_TIME_R
is 1.
* tests/test-time-c++.cc (localtime_r, gmtime_r): Likewise.
* modules/time_r (configure.ac): Invoke gl_TIME_MODULE_INDICATOR.
* modules/time (Makefile.am): Substitute GNULIB_TIME_R.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize GNULIB_TIME_R.

--- lib/time.in.h.orig  Sun Mar 14 19:50:53 2010
+++ lib/time.in.h   Sun Mar 14 19:46:59 2010
@@ -108,36 +108,38 @@
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
 and
.  */
-# if @REPLACE_LOCALTIME_R@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef localtime_r
-#   define localtime_r rpl_localtime_r
-#  endif
+# if @GNULIB_TIME_R@
+#  if @REPLACE_LOCALTIME_R@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#undef localtime_r
+#define localtime_r rpl_localtime_r
+#   endif
 _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
  struct tm *restrict __result)
 _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
  struct tm *restrict __result));
-# else
+#  else
 _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
  struct tm *restrict __result));
-# endif
-_GL_CXXALIASWARN (localtime_r);
-# if @REPLACE_LOCALTIME_R@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef gmtime_r
-#   define gmtime_r rpl_gmtime_r
 #  endif
+_GL_CXXALIASWARN (localtime_r);
+#  if @REPLACE_LOCALTIME_R@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#undef gmtime_r
+#define gmtime_r rpl_gmtime_r
+#   endif
 _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
   struct tm *restrict __result)
  _GL_ARG_NONNULL ((1, 2)));
 _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
   struct tm *restrict __result));
-# else
+#  else
 _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
   struct tm *restrict __result));
-# endif
+#  endif
 _GL_CXXALIASWARN (gmtime_r);
+# endif
 
 /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
the resulting broken-down time into TM.  See
--- m4/time_h.m4.orig   Sun Mar 14 19:50:53 2010
+++ m4/time_h.m4Sun Mar 14 19:48:12 2010
@@ -76,6 +76,7 @@
   GNULIB_NANOSLEEP=0;AC_SUBST([GNULIB_NANOSLEEP])
   GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME])
   GNULIB_TIMEGM=0;   AC_SUBST([GNULIB_TIMEGM])
+  GNULIB_TIME_R=0;   AC_SUBST([GNULIB_TIME_R])
   dnl If another module says to replace or to not replace, do that.
   dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
   dnl this lets maintainers check for portability.
--- modules/time.orig   Sun Mar 14 19:50:53 2010
+++ modules/timeSun Mar 14 19:47:59 2010
@@ -31,6 +31,7 @@
  -e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \
  -e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \
  -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \
+ -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \
  -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
  -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
  -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
--- modules/time_r.orig Sun Mar 14 19:50:53 2010
+++ modules/time_r  Sun Mar 14 19:45:27 2010
@@ -11,6 +11,7 @@
 
 configure.ac:
 gl_TIME_R
+gl_TIME_MODULE_INDICATOR([time_r])
 
 Makefile.am:
 
--- tests/test-time-c++.cc.orig Sun Mar 14 19:50:54 2010
+++ tests/test-time-c++.cc  Sun Mar 14 19:47:23 2010
@@ -33,11 +33,13 @@
 SIGNATURE_CHECK (GNULIB_NAMESPACE::mktime, time_t, (struct tm *));
 #endif
 
+#if GNULIB_TIME_R
 SIGNATURE_CHECK (GNULIB_NAMESPACE::localtime_r, struct tm *,
  (time_t const *, struct tm *));
 
 SIGNATURE_CHECK (GNULIB_NAMESPACE::gmtime_r, struct tm *,
  (time_t const *, struct tm *));
+#endif
 
 #if GNULIB_STRPTIME
 SIGNATURE_CHECK (GNULIB_NAMESPACE::strptime, char *,




posix_spawn fix

2010-03-14 Thread Bruno Haible
Compiling a testdir for 'spawn' on mingw, I see this error:

../gllib/spawn.h:406: error: `POSIX_SPAWN_RESETIDS' undeclared here (not in a 
function)
../gllib/spawn.h:407: error: `POSIX_SPAWN_SETPGROUP' undeclared here (not in a 
function)
../gllib/spawn.h:407: error: `POSIX_SPAWN_SETSIGDEF' undeclared here (not in a 
function)
../gllib/spawn.h:408: error: `POSIX_SPAWN_SETSIGMASK' undeclared here (not in a 
function)

This fixes it.


2010-03-14  Bruno Haible  

Fix compilation error when modules 'posix_spawn[p]' are not used.
* m4/spawn_h.m4 (gl_SPAWN_H): Set HAVE_POSIX_SPAWN here.
* m4/posix_spawn.m4 (gl_POSIX_SPAWN_BODY): ... not here.

--- m4/spawn_h.m4.orig  Sun Mar 14 20:07:18 2010
+++ m4/spawn_h.m4   Sun Mar 14 20:05:19 2010
@@ -1,4 +1,4 @@
-# spawn_h.m4 serial 7
+# spawn_h.m4 serial 8
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,11 @@
   fi
   AC_SUBST([HAVE_SPAWN_H])
 
+  AC_CHECK_FUNCS_ONCE([posix_spawn])
+  if test $ac_cv_func_posix_spawn != yes; then
+HAVE_POSIX_SPAWN=0
+  fi
+
   AC_REQUIRE([AC_C_RESTRICT])
 
   dnl Check for declarations of anything we want to poison if the
--- m4/posix_spawn.m4.orig  Sun Mar 14 20:07:18 2010
+++ m4/posix_spawn.m4   Sun Mar 14 20:05:27 2010
@@ -1,4 +1,4 @@
-# posix_spawn.m4 serial 5
+# posix_spawn.m4 serial 6
 dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -69,8 +69,6 @@
 ;;
   *) REPLACE_POSIX_SPAWN=1 ;;
 esac
-  else
-HAVE_POSIX_SPAWN=0
   fi
 ])
 




Re: cosl test failure

2010-03-14 Thread Bruno Haible
Hi Paolo,

On 2010-01-18, in
,
I observed that gnulib's cosl replacement function does not have the
necessary accuracy. This was due to a wrong formula: The term
  sincosl_table [index + SINCOSL_COS_HI] * cos_l_m1
was being subtracted, when it should have been added.

Also, in this formula and the other one for sinl(), you omitted one of
the five summands; I cannot see a reason why.

This fixes it.


2010-03-14  Bruno Haible  

Fix values returned by sinl, cosl.
* lib/trigl.h: Add specification comments.
* lib/sincosl.c (kernel_sinl, kernel_cosl): Fix comments and formula
that combines the values from the precomputed table with the values of
the Chebyshev polynomials.

*** lib/trigl.h.origSun Mar 14 23:11:58 2010
--- lib/trigl.h Sun Mar 14 22:14:54 2010
***
*** 18,24 
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see .  */
  
  extern int ieee754_rem_pio2l (long double x, long double *y);
  extern long double kernel_sinl (long double x, long double y, int iy);
- extern long double kernel_cosl (long double x, long double y);
  
--- 18,35 
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see .  */
  
+ /* Decompose x into x = k * π/2 + r
+where k is an integer and abs(r) <= π/4.
+Store r in y[0] and y[1] (main part in y[0], small additional part in
+y[1], r = y[0] + y[1]).
+Return k.  */
  extern int ieee754_rem_pio2l (long double x, long double *y);
+ 
+ /* Compute and return sinl (x + y), where x is the main part and y is the
+small additional part of a floating-point number.
+iy is 0 when y is known to be 0.0, otherwise iy is 1.  */
  extern long double kernel_sinl (long double x, long double y, int iy);
  
+ /* Compute and return cosl (x + y), where x is the main part and y is the
+small additional part of a floating-point number.  */
+ extern long double kernel_cosl (long double x, long double y);
*** lib/sincosl.c.orig  Sun Mar 14 23:11:58 2010
--- lib/sincosl.c   Sun Mar 14 23:04:53 2010
***
*** 136,146 
else
  {
/* So that we don't have to use too large polynomial,  we find
!  l and h such that x = l + h,  where fabsl(l) <= 1.0/256 with 83
!  possible values for h.  We look up cosl(h) and sinl(h) in
   pre-computed tables,  compute cosl(l) and sinl(l) using a
   Chebyshev polynomial of degree 10(11) and compute
!  sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l).  */
x -= 0.1484375L;
index = (int) (x * 128L + 0.5L);
h = index / 128.0L;
--- 136,147 
else
  {
/* So that we don't have to use too large polynomial,  we find
!  k and l such that x = k + l,  where fabsl(l) <= 1.0/256 with 83
!  possible values for k.  We look up cosl(k) and sinl(k) in
   pre-computed tables,  compute cosl(l) and sinl(l) using a
   Chebyshev polynomial of degree 10(11) and compute
!  sinl(k+l) = sinl(k)cosl(l) + cosl(k)sinl(l).
!  Furthermore write k = 0.1484375 + h.  */
x -= 0.1484375L;
index = (int) (x * 128L + 0.5L);
h = index / 128.0L;
***
*** 158,168 
  z * (SCOS1 + z * (SCOS2 + z * (SCOS3 + z * (SCOS4 + z * SCOS5;
  
index *= 4;
z =
! sincosl_table[index + SINCOSL_SIN_HI] +
! (sincosl_table[index + SINCOSL_SIN_LO] +
!  (sincosl_table[index + SINCOSL_SIN_HI] * cos_l_m1) +
!  (sincosl_table[index + SINCOSL_COS_HI] * sin_l));
return z * sign;
  }
  }
--- 159,172 
  z * (SCOS1 + z * (SCOS2 + z * (SCOS3 + z * (SCOS4 + z * SCOS5;
  
index *= 4;
+   /* We rely on this expression not being "contracted" by the compiler
+  (cf. ISO C 99 section 6.5 paragraph 8).  */
z =
! sincosl_table[index + SINCOSL_SIN_HI]
! + (sincosl_table[index + SINCOSL_COS_HI] * sin_l
!+ (sincosl_table[index + SINCOSL_SIN_HI] * cos_l_m1
!   + (sincosl_table[index + SINCOSL_SIN_LO] * (1 + cos_l_m1)
!  + sincosl_table[index + SINCOSL_COS_LO] * sin_l)));
return z * sign;
  }
  }
***
*** 195,205 
else
  {
/* So that we don't have to use too large polynomial,  we find
!  l and h such that x = l + h,  where fabsl(l) <= 1.0/256 with 83
!  possible values for h.  We look up cosl(h) and sinl(h) in
   pre-computed tables,  compute cosl(l) and sinl(l) using a
   Chebyshev polynomial of degree 10(11) and compute
!  sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l).  */
x -= 0.1484375L;
index = (int) (x * 128L + 0.5L);
h = index / 128.0L;
--- 199,210 
e

poll test failure on Cygwin

2010-03-14 Thread Bruno Haible
Hi Paolo, Eric,

On Cygwin 1.5.x the 'poll' test fails like this:

  Unconnected socket test... passed
  Connected sockets test... passed
  General socket test with fork... passed
  Pipe test... failed (expecting POLLHUP after shutdown)
  FAIL: test-poll.exe

What do you think? Is Cygwin broken? Or is the test too strict?

Bruno




Re: link-warning usage improvements

2010-03-14 Thread Bruno Haible
Eric Blake wrote on 2009-12-31:
> Date: Thu, 24 Dec 2009 12:06:48 -0700
> Subject: [PATCH 4/4] link-warning: always build headers with link warnings
> 
> Replacement headers must be built unconditionally if they use
> GL_LINK_WARNING, if the warning is to ever trigger on a
> glibc system during CFLAGS=-DGNULIB_POSIXCHECK.
> 
> * modules/arpa_inet (Makefile.am): Always build replacement
> header.
> * modules/ctype (Makefile.am): Likewise.
> * modules/dirent (Makefile.am): Likewise.
> * modules/inttypes (Makefile.am): Likewise.
> * modules/langinfo (Makefile.am): Likewise.
> * modules/locale (Makefile.am): Likewise.
> * modules/spawn (Makefile.am): Likewise.
> * modules/sys_file (Makefile.am): Likewise.
> * modules/sys_ioctl (Makefile.am): Likewise.
> * modules/sys_select (Makefile.am): Likewise.
> * modules/sys_socket (Makefile.am): Likewise.
> * modules/sys_times (Makefile.am): Likewise.
> * modules/sys_utsname (Makefile.am): Likewise.
> * modules/sys_wait (Makefile.am): Likewise.
> * modules/wchar (Makefile.am): Likewise.

When I create a testdir for the modules
  ./gnulib-tool --create-testdir --dir=... --with-tests flock unlink unlinkat 
pipe-filter-gi
and build it on MacOS X, I get a compilation error:

  ./sys/select.h:338:7: error: #if with no expression

The reason is that HAVE_WINSOCK2_H expands to empty, instead of 0 or 1. This is
because gl_PREREQ_SYS_H_WINSOCK2 has not been invoked. Apparently the *.m4
files have not been reviewed when the above commit was made.

This fixes it:

2010-03-14  Bruno Haible  

Fix bug introduced on 2009-12-31.
* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Invoke
gl_PREREQ_SYS_H_WINSOCK2 always.
* m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise. Remove
SYS_SOCKET_H variable.
* m4/sys_file_h.m4 (gl_HEADER_SYS_FILE_H): Remove test for flock.
Update comments.
* m4/ctype.m4 (gl_CTYPE_H): Update comments.
* m4/langinfo_h.m4 (gl_LANGINFO_H): Likewise.
* m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise.
* m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H): Likewise.
* m4/sys_wait_h.m4 (gl_SYS_WAIT_H): Likewise.

--- m4/sys_select_h.m4.orig Mon Mar 15 00:28:05 2010
+++ m4/sys_select_h.m4  Mon Mar 15 00:23:33 2010
@@ -1,4 +1,4 @@
-# sys_select_h.m4 serial 12
+# sys_select_h.m4 serial 13
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -46,6 +46,7 @@
   fi
 ])
   AC_CHECK_HEADERS_ONCE([sys/select.h])
+  dnl  is always overridden, because of GNULIB_POSIXCHECK.
   gl_CHECK_NEXT_HEADERS([sys/select.h])
   if test $ac_cv_header_sys_select_h = yes; then
 HAVE_SYS_SELECT_H=1
@@ -53,9 +54,7 @@
 HAVE_SYS_SELECT_H=0
   fi
   AC_SUBST([HAVE_SYS_SELECT_H])
-  if test $gl_cv_header_sys_select_h_selfcontained != yes; then
-gl_PREREQ_SYS_H_WINSOCK2
-  fi
+  gl_PREREQ_SYS_H_WINSOCK2
 
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
--- m4/sys_socket_h.m4.orig Mon Mar 15 00:28:05 2010
+++ m4/sys_socket_h.m4  Mon Mar 15 00:22:10 2010
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 15
+# sys_socket_h.m4 serial 16
 dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -19,7 +19,6 @@
 [gl_cv_header_sys_socket_h_selfcontained=no])
 ])
   if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
-SYS_SOCKET_H=''
 dnl If the shutdown function exists,  should define
 dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
 AC_CHECK_FUNCS([shutdown])
@@ -37,8 +36,6 @@
 SYS_SOCKET_H='sys/socket.h'
   fi
 fi
-  else
-SYS_SOCKET_H='sys/socket.h'
   fi
   # We need to check for ws2tcpip.h now.
   gl_PREREQ_SYS_H_SOCKET
@@ -56,16 +53,11 @@
 ])
   if test $ac_cv_type_struct_sockaddr_storage = no; then
 HAVE_STRUCT_SOCKADDR_STORAGE=0
-SYS_SOCKET_H='sys/socket.h'
   fi
   if test $ac_cv_type_sa_family_t = no; then
 HAVE_SA_FAMILY_T=0
-SYS_SOCKET_H='sys/socket.h'
   fi
-  if test -n "$SYS_SOCKET_H"; then
-gl_PREREQ_SYS_H_WINSOCK2
-  fi
-  AC_SUBST([SYS_SOCKET_H])
+  gl_PREREQ_SYS_H_WINSOCK2
 
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
--- m4/sys_file_h.m4.orig   Mon Mar 15 00:28:05 2010
+++ m4/sys_file_h.m4Mon Mar 15 00:19:18 2010
@@ -1,7 +1,7 @@
 # Configure a replacement for .
-# serial 3
+# serial 4
 
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008-2010 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -12,10 +12,7 @@
 [
   AC_REQUIRE

unlink test failure on MacOS X

2010-03-14 Thread Bruno Haible
Hi Jim, Eric,

On MacOS X 10.5, the unlink() and unlinkat() tests fail:

  test-unlink.h:49: assertion failed
  /bin/sh: line 1: 17670 Abort trap  EXEEXT='' srcdir='.' ${dir}$tst
  FAIL: test-unlink

  test-unlink.h:49: assertion failed
  /bin/sh: line 1: 63034 Abort trap  EXEEXT='' srcdir='.' ${dir}$tst
  FAIL: test-unlinkat

The reason is that unlink("..") returns 0 without having done any side effects
on the file system. Likewise for unlink("../..").

Test program:
= foo.c 
#include 
#include 
#include 
int main ()
{
  int ret = unlink ("../..");
  printf ("%d %d\n", ret, errno);
  return 0;
}


This prints
-1 21 [EISDIR]
on Linux, but
0 0
on MacOS X.

Is the test too strict? Or should we add a workaround to lib/unlink.c
and lib/unlinkat.c? The workaround could consist in testing whether the
file name is ".." or ends in "/..".

Bruno




iconv_open: Build failure with gperf 2.7.2

2010-03-14 Thread Ludovic Courtès
Hello,

The ‘-m’ gperf option used by the ‘iconv_open’ module isn’t available in
the ancient gperf 2.7.2:

--8<---cut here---start->8---
Making all in lib
rm -f alloca.h-t alloca.h &&  { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! 
*/';  cat ../../lib/alloca.in.h;  } > alloca.h-t &&  mv -f alloca.h-t alloca.h
rm -f arg-nonnull.h-t arg-nonnull.h &&  sed -n -e '/GL_ARG_NONNULL/,$p'  < 
../../build-aux/arg-nonnull.h  > arg-nonnull.h-t &&  mv arg-nonnull.h-t 
arg-nonnull.h
rm -f c++defs.h-t c++defs.h &&  sed -n -e '/_GL_CXXDEFS/,$p'  < 
../../build-aux/c++defs.h  > c++defs.h-t &&  mv c++defs.h-t c++defs.h
gperf -m 10 ../../lib/iconv_open-aix.gperf > ../../lib/iconv_open-aix.h-t
gperf -m 10 ../../lib/iconv_open-hpux.gperf > ../../lib/iconv_open-hpux.h-t
gperf: invalid option -- m
Usage: gperf 
[-cCdDef[num]FGhHiIjkKlLnNorsStTvWZ7] [input-file]
Try `gperf --help' for more information.
*** Error code 1
gperf: invalid option -- m
Usage: gperf 
[-cCdDef[num]FGhHiIjkKlLnNorsStTvWZ7] [input-file]
Try `gperf --help' for more information.
*** Error code 1
2 errors
*** Error code 1
1 error
*** Error code 2
1 error

$ gperf --version
GNU gperf 2.7.2
--8<---cut here---end--->8---

(This is on GCC Compile Farm’s ‘gcc101’.)

What should be done about it?

Thanks,
Ludo’.




flock test failures on Solaris and MacOS X

2010-03-14 Thread Bruno Haible
Hi,

In 
and 
it was reported that the 'flock' tests fail on MacOS X 10.5. This is
still the case today:

  test-flock.c:80: assertion failed
  /bin/sh: line 1: 62455 Abort trap
  FAIL: test-flock

In 
it was reported that the 'flock' tests fail on Solaris 10. This is
still the case today:

  test-flock.c:62: assertion failed
  bash: line 5: 16978 Abort   (core dumped) EXEEXT='' 
srcdir='.' ${dir}$tst
  FAIL: test-flock

There was no reaction to these reports. So the 'flock' module is apparently
unmaintained?

Regarding the MacOS X failure, I think most programs can live without flock()
rejecting invalid arguments. Therefore the best solution is to comment out the
part of the test that is revealed too strict.

Regarding the Solaris failure - an attempt to set a shared lock where an
exclusive lock is already set - it should fail according to the Solaris manual
page. Bug in Solaris. It fails on Linux, but - according to the Linux manual
page - should succeed. Bug in Linux. So this test is best commented out on all
platforms. I'm applying this.

With this, the test succeeds on MacOS X and still fails on Solaris - must be a
bug in gnulib's flock replacement or in Solaris' fcntl implementation; to be
investigated.


2010-03-14  Bruno Haible  

* tests/test-flock.c (test_exclusive): Comment out a test that causes
portability problems. Instead use a simpler test.
(main): Check that invalid arguments are rejected only on Linux.

--- tests/test-flock.c.orig Mon Mar 15 02:54:34 2010
+++ tests/test-flock.c  Mon Mar 15 02:54:24 2010
@@ -58,9 +58,31 @@
   fd2 = open (file, O_RDWR, 0644);
   ASSERT (fd2 >= 0);
 
-  r = flock (fd2, LOCK_SH | LOCK_NB);
+  r = flock (fd2, LOCK_EX | LOCK_NB);
   ASSERT (r == -1); /* Was unable to acquire a second exclusive 
lock. */
 
+#if 0
+  /* The Linux manual page of flock(2) says:
+   "A process may only hold one type of lock (shared or exclusive) on a
+   file. Subsequent flock() calls on an already locked file will convert
+   an existing lock to the new lock mode."
+ So, the call below should convert the exclusive lock for fd to a shared
+ and thus succeeds.  The fact that it doesn't but instead fails is
+ apparently a bug.  */
+  /* The Solaris manual page of flock(2) says:
+   "More than one process may hold a shared lock for a file at any given
+time, but multiple exclusive, or both shared and exclusive, locks may
+not exist simultaneously on a file. ...
+Requesting a lock on an object that is already locked normally causes
+the caller to block until the lock may be acquired. If LOCK_NB is
+included in operation, then this will not happen; instead, the call
+will fail and the error EWOULDBLOCK will be returned."
+ So, the call below should fail and set errno to EWOULDBLOCK.  The fact
+ that it succeeds is apparently a bug.  */
+  r = flock (fd2, LOCK_SH | LOCK_NB);
+  ASSERT (r == -1);
+#endif
+
   ASSERT (flock (fd, LOCK_UN) == 0);
   ASSERT (close (fd2) == 0);
 }
@@ -76,7 +98,9 @@
   ASSERT (fd >= 0);
   ASSERT (write (fd, "hello", 5) == 5);
 
-  /* Some impossible operation codes which should never be accepted. */
+#if defined __linux__
+  /* Invalid operation codes are rejected by the Linux implementation and by
+ the gnulib replacement,  but not by the MacOS X implementation.  */
   ASSERT (flock (fd, LOCK_SH | LOCK_EX) == -1);
   ASSERT (errno == EINVAL);
   ASSERT (flock (fd, LOCK_SH | LOCK_UN) == -1);
@@ -85,6 +109,7 @@
   ASSERT (errno == EINVAL);
   ASSERT (flock (fd, 0) == -1);
   ASSERT (errno == EINVAL);
+#endif
 
   test_shared (file, fd);
   test_exclusive (file, fd);




Re: iconv_open: Build failure with gperf 2.7.2

2010-03-14 Thread Bruno Haible
Hi Ludo,

Ludovic Courtès wrote:
> The ‘-m’ gperf option used by the ‘iconv_open’ module isn’t available in
> the ancient gperf 2.7.2:

It is documented in gnulib's DEPENDENCIES file:

* GNU gperf 3.0.1 or newer.
  + Recommended.
Needed if you use the 'iconv_open' module.
  + Homepage:
http://www.gnu.org/software/gperf/
  + Download:
http://ftp.gnu.org/gnu/gperf/
ftp://ftp.gnu.org/gnu/gperf/

> What should be done about it?

Run gnulib-tool and create your distribution tarballs on a machine that has
gperf 3.0.1 or newer installed. Preferrably gperf 3.0.4.

Bruno




Re: cosl test failure

2010-03-14 Thread Paolo Bonzini
On Sun, Mar 14, 2010 at 23:18, Bruno Haible  wrote:
> Hi Paolo,
>
> On 2010-01-18, in
> ,
> I observed that gnulib's cosl replacement function does not have the
> necessary accuracy. This was due to a wrong formula: The term
>  sincosl_table [index + SINCOSL_COS_HI] * cos_l_m1
> was being subtracted, when it should have been added.

I totally cannot recall, sorry.  Thanks for fixing it, it was on my
todo list but you beat me.

Paolo

> Also, in this formula and the other one for sinl(), you omitted one of
> the five summands; I cannot see a reason why.
>
> This fixes it.
>
>
> 2010-03-14  Bruno Haible  
>
>        Fix values returned by sinl, cosl.
>        * lib/trigl.h: Add specification comments.
>        * lib/sincosl.c (kernel_sinl, kernel_cosl): Fix comments and formula
>        that combines the values from the precomputed table with the values of
>        the Chebyshev polynomials.
>
> *** lib/trigl.h.orig    Sun Mar 14 23:11:58 2010
> --- lib/trigl.h Sun Mar 14 22:14:54 2010
> ***
> *** 18,24 
>     You should have received a copy of the GNU General Public License
>     along with this program.  If not, see .  */
>
>  extern int ieee754_rem_pio2l (long double x, long double *y);
>  extern long double kernel_sinl (long double x, long double y, int iy);
> - extern long double kernel_cosl (long double x, long double y);
>
> --- 18,35 
>     You should have received a copy of the GNU General Public License
>     along with this program.  If not, see .  */
>
> + /* Decompose x into x = k * π/2 + r
> +    where k is an integer and abs(r) <= π/4.
> +    Store r in y[0] and y[1] (main part in y[0], small additional part in
> +    y[1], r = y[0] + y[1]).
> +    Return k.  */
>  extern int ieee754_rem_pio2l (long double x, long double *y);
> +
> + /* Compute and return sinl (x + y), where x is the main part and y is the
> +    small additional part of a floating-point number.
> +    iy is 0 when y is known to be 0.0, otherwise iy is 1.  */
>  extern long double kernel_sinl (long double x, long double y, int iy);
>
> + /* Compute and return cosl (x + y), where x is the main part and y is the
> +    small additional part of a floating-point number.  */
> + extern long double kernel_cosl (long double x, long double y);
> *** lib/sincosl.c.orig  Sun Mar 14 23:11:58 2010
> --- lib/sincosl.c       Sun Mar 14 23:04:53 2010
> ***
> *** 136,146 
>    else
>      {
>        /* So that we don't have to use too large polynomial,  we find
> !          l and h such that x = l + h,  where fabsl(l) <= 1.0/256 with 83
> !          possible values for h.  We look up cosl(h) and sinl(h) in
>           pre-computed tables,  compute cosl(l) and sinl(l) using a
>           Chebyshev polynomial of degree 10(11) and compute
> !          sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l).  */
>        x -= 0.1484375L;
>        index = (int) (x * 128L + 0.5L);
>        h = index / 128.0L;
> --- 136,147 
>    else
>      {
>        /* So that we don't have to use too large polynomial,  we find
> !          k and l such that x = k + l,  where fabsl(l) <= 1.0/256 with 83
> !          possible values for k.  We look up cosl(k) and sinl(k) in
>           pre-computed tables,  compute cosl(l) and sinl(l) using a
>           Chebyshev polynomial of degree 10(11) and compute
> !          sinl(k+l) = sinl(k)cosl(l) + cosl(k)sinl(l).
> !          Furthermore write k = 0.1484375 + h.  */
>        x -= 0.1484375L;
>        index = (int) (x * 128L + 0.5L);
>        h = index / 128.0L;
> ***
> *** 158,168 
>          z * (SCOS1 + z * (SCOS2 + z * (SCOS3 + z * (SCOS4 + z * SCOS5;
>
>        index *= 4;
>        z =
> !         sincosl_table[index + SINCOSL_SIN_HI] +
> !         (sincosl_table[index + SINCOSL_SIN_LO] +
> !          (sincosl_table[index + SINCOSL_SIN_HI] * cos_l_m1) +
> !          (sincosl_table[index + SINCOSL_COS_HI] * sin_l));
>        return z * sign;
>      }
>  }
> --- 159,172 
>          z * (SCOS1 + z * (SCOS2 + z * (SCOS3 + z * (SCOS4 + z * SCOS5;
>
>        index *= 4;
> +       /* We rely on this expression not being "contracted" by the compiler
> +          (cf. ISO C 99 section 6.5 paragraph 8).  */
>        z =
> !         sincosl_table[index + SINCOSL_SIN_HI]
> !         + (sincosl_table[index + SINCOSL_COS_HI] * sin_l
> !            + (sincosl_table[index + SINCOSL_SIN_HI] * cos_l_m1
> !               + (sincosl_table[index + SINCOSL_SIN_LO] * (1 + cos_l_m1)
> !                  + sincosl_table[index + SINCOSL_COS_LO] * sin_l)));
>        return z * sign;
>      }
>  }
> ***
> *** 195,205 
>    else
>      {
>        /* So that we don't have to use too large polynomial,  we find
> !          l and h such that x = l + h,  where fabsl(l) <= 1.0/256 with 83
> !          possible values for h.  We look up cosl(h) and si

Re: poll test failure on Cygwin

2010-03-14 Thread Paolo Bonzini
On Sun, Mar 14, 2010 at 23:33, Bruno Haible  wrote:
> Hi Paolo, Eric,
>
> On Cygwin 1.5.x the 'poll' test fails like this:
>
>  Unconnected socket test... passed
>  Connected sockets test... passed
>  General socket test with fork... passed
>  Pipe test... failed (expecting POLLHUP after shutdown)
>  FAIL: test-poll.exe
>
> What do you think? Is Cygwin broken? Or is the test too strict?

On one hand Cygwin has its own poll and does not use gnulib's
replacement, so this means it is broken.

On the other hand, poll/select are broken on Windows for pipes anyway
(and not fixable), so they probably shouldn't be tested in
test-poll/test-select.

We should do the same test on 1.7, and if it fails extract a
standalone test for pipes and send it to the cygwin ML.

Paolo