diff options
-rw-r--r--[-rwxr-xr-x] | build-aux/gendocs.sh | 16 | ||||
-rwxr-xr-x | build-aux/gnupload | 12 | ||||
-rw-r--r-- | gl/Makefile.am | 9 | ||||
-rw-r--r-- | gl/m4/getdelim.m4 | 65 | ||||
-rw-r--r-- | gl/m4/getline.m4 | 38 | ||||
-rw-r--r-- | gl/m4/gettimeofday.m4 | 61 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 1 | ||||
-rw-r--r-- | gl/m4/stdio_h.m4 | 3 | ||||
-rw-r--r-- | gl/m4/sys_time_h.m4 | 44 | ||||
-rw-r--r-- | gl/netdb.in.h | 28 | ||||
-rw-r--r-- | gl/stdio.in.h | 8 | ||||
-rw-r--r-- | gl/sys_time.in.h | 16 | ||||
-rw-r--r-- | gl/tests/test-getdelim.c | 19 | ||||
-rw-r--r-- | gl/tests/test-getline.c | 19 | ||||
-rw-r--r-- | gl/tests/test-gettimeofday.c | 8 | ||||
-rw-r--r-- | lib/gl/Makefile.am | 1 | ||||
-rw-r--r-- | lib/gl/m4/stdio_h.m4 | 3 | ||||
-rw-r--r-- | lib/gl/netdb.in.h | 28 | ||||
-rw-r--r-- | lib/gl/stdio.in.h | 8 | ||||
-rw-r--r-- | maint.mk | 41 |
20 files changed, 313 insertions, 115 deletions
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh index b50a6c7ffd..67d5b52cab 100755..100644 --- a/build-aux/gendocs.sh +++ b/build-aux/gendocs.sh @@ -2,7 +2,7 @@ # gendocs.sh -- generate a GNU manual in many formats. This script is # mentioned in maintain.texi. See the help message below for usage details. -scriptversion=2010-01-02.16 +scriptversion=2010-02-13.20 # Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. @@ -56,6 +56,7 @@ See the GNU Maintainers document for a more extensive discussion: http://www.gnu.org/prep/maintain_toc.html Options: + -s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi} -o OUTDIR write files into OUTDIR, instead of manual/. --email ADR use ADR as contact in generated web pages. --docbook convert to DocBook too (xml, txt, html, pdf and ps). @@ -119,12 +120,14 @@ PACKAGE= EMAIL=webmasters@gnu.org # please override with --email htmlarg= outdir=manual +srcfile= while test $# -gt 0; do case $1 in --email) shift; EMAIL=$1;; --help) echo "$usage"; exit 0;; --version) echo "$version"; exit 0;; + -s) shift; srcfile=$1;; -o) shift; outdir=$1;; --docbook) docbook=yes;; --html) shift; htmlarg=$1;; @@ -146,7 +149,9 @@ while test $# -gt 0; do shift done -if test -s "$srcdir/$PACKAGE.texinfo"; then +if test -n "$srcfile"; then + : +elif test -s "$srcdir/$PACKAGE.texinfo"; then srcfile=$srcdir/$PACKAGE.texinfo elif test -s "$srcdir/$PACKAGE.texi"; then srcfile=$srcdir/$PACKAGE.texi @@ -268,13 +273,14 @@ else fi echo Making .tar.gz for sources... -srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` || true +d=`dirname $srcfile` +srcfiles=`ls $d/*.texinfo $d/*.texi $d/*.txi $d/*.eps 2>/dev/null` || true tar cvzfh $outdir/$PACKAGE.texi.tar.gz $srcfiles texi_tgz_size=`calcsize $outdir/$PACKAGE.texi.tar.gz` if test -n "$docbook"; then cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml" - echo "Generating docbook XML... $(cmd)" + echo "Generating docbook XML... ($cmd)" eval "$cmd" docbook_xml_size=`calcsize $PACKAGE-db.xml` gzip -f -9 -c $PACKAGE-db.xml >$outdir/$PACKAGE-db.xml.gz @@ -302,7 +308,7 @@ if test -n "$docbook"; then mv $PACKAGE-db.txt $outdir/ cmd="${DOCBOOK2PS} ${outdir}/$PACKAGE-db.xml" - echo "Generating docbook PS... $(cmd)" + echo "Generating docbook PS... ($cmd)" eval "$cmd" gzip -f -9 -c $PACKAGE-db.ps >$outdir/$PACKAGE-db.ps.gz docbook_ps_gz_size=`calcsize $outdir/$PACKAGE-db.ps.gz` diff --git a/build-aux/gnupload b/build-aux/gnupload index 6943ca9143..c28a5cc13c 100755 --- a/build-aux/gnupload +++ b/build-aux/gnupload @@ -1,9 +1,10 @@ #!/bin/sh # Sign files and upload them. -scriptversion=2010-01-27.15; # UTC +scriptversion=2010-02-08.07; # UTC -# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,10 +33,11 @@ delete_symlinks= collect_var= dbg= -usage="Usage: $0 [OPTIONS]... [COMMAND] FILES... [[COMMAND] FILES...] +usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...] -Sign all FILES, and upload them to selected destinations, according to -<http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>. +Sign all FILES, and process them at selected destinations according to CMD. +<http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html> +explains further. Commands: --delete delete FILES from destination diff --git a/gl/Makefile.am b/gl/Makefile.am index 203a514a0a..cdcb1cbd7a 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -748,6 +748,7 @@ stdio.h: stdio.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ + -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ @@ -1078,11 +1079,11 @@ EXTRA_DIST += sys_stat.in.h ## begin gnulib module sys_time -BUILT_SOURCES += $(SYS_TIME_H) +BUILT_SOURCES += sys/time.h # We need the following in order to create <sys/time.h> when the system # doesn't have one that works with the given compiler. -sys/time.h: sys_time.in.h $(ARG_NONNULL_H) +sys/time.h: sys_time.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -1090,9 +1091,11 @@ sys/time.h: sys_time.in.h $(ARG_NONNULL_H) -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \ - -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \ + -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \ -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \ + -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/sys_time.in.h; \ } > $@-t && \ mv $@-t $@ diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4 index 9e5ad5baaf..4beb1501c2 100644 --- a/gl/m4/getdelim.m4 +++ b/gl/m4/getdelim.m4 @@ -1,6 +1,6 @@ -# getdelim.m4 serial 5 +# getdelim.m4 serial 6 -dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc. dnl dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,16 +15,71 @@ AC_DEFUN([gl_FUNC_GETDELIM], dnl Persuade glibc <stdio.h> to declare getdelim(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_REPLACE_FUNCS([getdelim]) AC_CHECK_DECLS_ONCE([getdelim]) - if test $ac_cv_func_getdelim = no; then - gl_PREREQ_GETDELIM + AC_CHECK_FUNCS_ONCE([getdelim]) + if test $ac_cv_func_getdelim = yes; then + dnl Found it in some library. Verify that it works. + AC_CACHE_CHECK([for working getdelim function], [gl_cv_func_working_getdelim], + [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +# include <stdio.h> +# include <stdlib.h> +# include <string.h> + int main () + { + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + { + /* Test result for a NULL buffer and a zero size. + Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len = getdelim (&line, &siz, '\n', in); + if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) + return 1; + } + { + /* Test result for a NULL buffer and a non-zero size. + This crashes on FreeBSD 8.0. */ + char *line = NULL; + size_t siz = (size_t)(~0) / 4; + if (getdelim (&line, &siz, '\n', in) == -1) + return 1; + } + return 0; + } + ]])], [gl_cv_func_working_getdelim=yes] dnl The library version works. + , [gl_cv_func_working_getdelim=no] dnl The library version does NOT work. + , dnl We're cross compiling. Assume it works on glibc2 systems. + [AC_EGREP_CPP([Lucky GNU user], + [ +#include <features.h> +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ >= 2) + Lucky GNU user + #endif +#endif + ], + [gl_cv_func_working_getdelim=yes], + [gl_cv_func_working_getdelim=no])] + )]) + else + gl_cv_func_working_getdelim=no fi if test $ac_cv_have_decl_getdelim = no; then HAVE_DECL_GETDELIM=0 fi + + if test $gl_cv_func_working_getdelim = no; then + if test $ac_cv_func_getdelim = yes; then + REPLACE_GETDELIM=1 + fi + AC_LIBOBJ([getdelim]) + gl_PREREQ_GETDELIM + fi ]) # Prerequisites of lib/getdelim.c. diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4 index 5b8a712fbc..83005600d6 100644 --- a/gl/m4/getline.m4 +++ b/gl/m4/getline.m4 @@ -1,4 +1,4 @@ -# getline.m4 serial 20 +# getline.m4 serial 21 dnl Copyright (C) 1998-2003, 2005-2007, 2009-2010 Free Software Foundation, dnl Inc. @@ -24,26 +24,39 @@ AC_DEFUN([gl_FUNC_GETLINE], gl_getline_needs_run_time_check=no AC_CHECK_FUNC([getline], - dnl Found it in some library. Verify that it works. - gl_getline_needs_run_time_check=yes, - am_cv_func_working_getline=no) + [dnl Found it in some library. Verify that it works. + gl_getline_needs_run_time_check=yes], + [am_cv_func_working_getline=no]) if test $gl_getline_needs_run_time_check = yes; then AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline], - [echo fooN |tr -d '\012'|tr N '\012' > conftest.data + [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data AC_RUN_IFELSE([AC_LANG_SOURCE([[ # include <stdio.h> # include <stdlib.h> # include <string.h> int main () - { /* Based on a test program from Karl Heuer. */ - char *line = NULL; - size_t siz = 0; - int len; + { FILE *in = fopen ("./conftest.data", "r"); if (!in) return 1; - len = getline (&line, &siz, in); - exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1); + { + /* Test result for a NULL buffer and a zero size. + Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len = getline (&line, &siz, in); + if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) + return 1; + } + { + /* Test result for a NULL buffer and a non-zero size. + This crashes on FreeBSD 8.0. */ + char *line = NULL; + size_t siz = (size_t)(~0) / 4; + if (getline (&line, &siz, in) == -1) + return 1; + } + return 0; } ]])], [am_cv_func_working_getline=yes] dnl The library version works. , [am_cv_func_working_getline=no] dnl The library version does NOT work. @@ -67,6 +80,9 @@ AC_DEFUN([gl_FUNC_GETLINE], fi if test $am_cv_func_working_getline = no; then + dnl Set REPLACE_GETLINE always: Even if we have not found the broken + dnl getline function among $LIBS, it may exist in libinet and the + dnl executable may be linked with -linet. REPLACE_GETLINE=1 AC_LIBOBJ([getline]) diff --git a/gl/m4/gettimeofday.m4 b/gl/m4/gettimeofday.m4 index 735123e6dc..32e4f29a9f 100644 --- a/gl/m4/gettimeofday.m4 +++ b/gl/m4/gettimeofday.m4 @@ -1,4 +1,4 @@ -# serial 12 +# serial 14 # Copyright (C) 2001-2003, 2005, 2007, 2009-2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -11,33 +11,49 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY], [ AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_SYS_TIME_H]) + AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([gettimeofday]) - AC_CACHE_CHECK([for gettimeofday with POSIX signature], - [gl_cv_func_gettimeofday_posix_signature], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/time.h> - struct timeval c; - ]], - [[ - int (*f) (struct timeval *restrict, void *restrict) = gettimeofday; - int x = f (&c, 0); - return !(x | c.tv_sec | c.tv_usec); - ]])], - [gl_cv_func_gettimeofday_posix_signature=yes], - [gl_cv_func_gettimeofday_posix_signature=no])]) - - gl_FUNC_GETTIMEOFDAY_CLOBBER - - if test $gl_cv_func_gettimeofday_posix_signature != yes; then - REPLACE_GETTIMEOFDAY=1 - SYS_TIME_H=sys/time.h - if test $gl_cv_func_gettimeofday_clobber != yes; then + gl_gettimeofday_timezone=void + if test $ac_cv_func_gettimeofday = yes; then + gl_FUNC_GETTIMEOFDAY_CLOBBER + AC_CACHE_CHECK([for gettimeofday with POSIX signature], + [gl_cv_func_gettimeofday_posix_signature], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/time.h> + struct timeval c; + int gettimeofday (struct timeval *restrict, void *restrict); + ]], + [[/* glibc uses struct timezone * rather than the POSIX void * + if _GNU_SOURCE is defined. However, since the only portable + use of gettimeofday uses NULL as the second parameter, and + since the glibc definition is actually more typesafe, it is + not worth wrapping this to get a compliant signature. */ + int (*f) (struct timeval *restrict, void *restrict) + = gettimeofday; + int x = f (&c, 0); + return !(x | c.tv_sec | c.tv_usec); + ]])], + [gl_cv_func_gettimeofday_posix_signature=yes], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/time.h> +int gettimeofday (struct timeval *restrict, struct timezone *restrict); + ]])], + [gl_cv_func_gettimeofday_posix_signature=almost], + [gl_cv_func_gettimeofday_posix_signature=no])])]) + if test $gl_cv_func_gettimeofday_posix_signature = almost; then + gl_gettimeofday_timezone='struct timezone' + elif test $gl_cv_func_gettimeofday_posix_signature != yes; then + REPLACE_GETTIMEOFDAY=1 AC_LIBOBJ([gettimeofday]) gl_PREREQ_GETTIMEOFDAY fi fi + AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone], + [Define this to 'void' or 'struct timezone' to match the system's + declaration of the second argument to gettimeofday.]) ]) @@ -78,7 +94,6 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER], if test $gl_cv_func_gettimeofday_clobber = yes; then REPLACE_GETTIMEOFDAY=1 - SYS_TIME_H=sys/time.h gl_GETTIMEOFDAY_REPLACE_LOCALTIME AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1], [Define if gettimeofday clobbers the localtime buffer.]) diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 9ee2c0a593..4f08319901 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -238,6 +238,7 @@ AC_SUBST([LTALLOCA]) gl_source_base='gl/tests' gl_FUNC_UNGETC_WORKS gl_FUNC_GETTIMEOFDAY + gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) AC_C_BIGENDIAN AC_C_BIGENDIAN AC_REQUIRE([gl_HEADER_SYS_SOCKET]) diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index 20af579d14..781fa8d388 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 24 +# stdio_h.m4 serial 25 dnl Copyright (C) 2007-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, @@ -111,6 +111,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) + REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM]) REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR]) diff --git a/gl/m4/sys_time_h.m4 b/gl/m4/sys_time_h.m4 index 9c16487957..b14bc4ba2b 100644 --- a/gl/m4/sys_time_h.m4 +++ b/gl/m4/sys_time_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for <sys/time.h>. -# serial 2 +# serial 3 # Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -19,15 +19,13 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H], AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], [ AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) AC_CHECK_HEADERS_ONCE([sys/time.h]) gl_CHECK_NEXT_HEADERS([sys/time.h]) - if test $ac_cv_header_sys_time_h = yes; then - HAVE_SYS_TIME_H=1 - else + if test $ac_cv_header_sys_time_h != yes; then HAVE_SYS_TIME_H=0 fi - AC_SUBST([HAVE_SYS_TIME_H]) AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval], [AC_COMPILE_IFELSE( @@ -40,20 +38,32 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], [[static struct timeval x; x.tv_sec = x.tv_usec;]])], [gl_cv_sys_struct_timeval=yes], [gl_cv_sys_struct_timeval=no])]) - if test $gl_cv_sys_struct_timeval = yes; then - HAVE_STRUCT_TIMEVAL=1 - else + if test $gl_cv_sys_struct_timeval != yes; then HAVE_STRUCT_TIMEVAL=0 fi - AC_SUBST([HAVE_STRUCT_TIMEVAL]) + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +#if HAVE_SYS_TIME_H +# include <sys/time.h> +#endif +#include <time.h> + ]], [gettimeofday]) +]) + +AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS], +[ + GNULIB_GETTIMEOFDAY=0; AC_SUBST([GNULIB_GETTIMEOFDAY]) dnl Assume POSIX behavior unless another module says otherwise. - REPLACE_GETTIMEOFDAY=0 - AC_SUBST([REPLACE_GETTIMEOFDAY]) - if test $HAVE_SYS_TIME_H = 0 || test $HAVE_STRUCT_TIMEVAL = 0; then - SYS_TIME_H=sys/time.h - else - SYS_TIME_H= - fi - AC_SUBST([SYS_TIME_H]) + HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL]) + HAVE_SYS_TIME_H=1; AC_SUBST([HAVE_SYS_TIME_H]) + REPLACE_GETTIMEOFDAY=0; AC_SUBST([REPLACE_GETTIMEOFDAY]) ]) diff --git a/gl/netdb.in.h b/gl/netdb.in.h index 92daa51386..6e0f966c9a 100644 --- a/gl/netdb.in.h +++ b/gl/netdb.in.h @@ -74,18 +74,24 @@ struct addrinfo # endif # if 0 -/* The commented out definitions below are not yet implemented in the - GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact, - cause conflicts on systems with a getaddrinfo() function which does not - define them. - - If they are restored, be sure to protect the definitions with #ifndef. */ # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ -# define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */ -# define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */ -# define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose - returned address type.. */ -# endif /* 0 */ +# endif + +/* These symbolic constants are required to be present by POSIX, but + our getaddrinfo replacement doesn't use them (yet). Setting them + to 0 on systems that doesn't have them avoids causing problems for + system getaddrinfo implementations that would be confused by + unknown values. */ +# ifndef AI_V4MAPPED +# define AI_V4MAPPED 0 /* 0x0008: IPv4 mapped addresses are acceptable. */ +# endif +# ifndef AI_ALL +# define AI_ALL 0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */ +# endif +# ifndef AI_ADDRCONFIG +# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose + returned address type.. */ +# endif /* Error values for `getaddrinfo' function. */ # ifndef EAI_BADFLAGS diff --git a/gl/stdio.in.h b/gl/stdio.in.h index 6b72c39cb7..96010d2347 100644 --- a/gl/stdio.in.h +++ b/gl/stdio.in.h @@ -340,7 +340,11 @@ extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream) #endif #if @GNULIB_GETDELIM@ -# if !@HAVE_DECL_GETDELIM@ +# if @REPLACE_GETDELIM@ +# undef getdelim +# define getdelim rpl_getdelim +# endif +# if !@HAVE_DECL_GETDELIM@ || @REPLACE_GETDELIM@ /* Read input, up to (and including) the next occurrence of DELIMITER, from STREAM, store it in *LINEPTR (and NUL-terminate it). *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE @@ -382,7 +386,7 @@ _GL_WARN_ON_USE (getline, "getline is unportable - " # endif #endif -#if @GNULIB_OBSTACK_PRINTF@ +#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ # if @REPLACE_OBSTACK_PRINTF@ # define obstack_printf rpl_osbtack_printf # define obstack_vprintf rpl_obstack_vprintf diff --git a/gl/sys_time.in.h b/gl/sys_time.in.h index 028093c627..e00f85807f 100644 --- a/gl/sys_time.in.h +++ b/gl/sys_time.in.h @@ -41,6 +41,8 @@ /* The definition of _GL_ARG_NONNULL is copied here. */ +/* The definition of _GL_WARN_ON_USE is copied here. */ + #ifdef __cplusplus extern "C" { #endif @@ -53,11 +55,19 @@ struct timeval }; # endif -# if @REPLACE_GETTIMEOFDAY@ -# undef gettimeofday -# define gettimeofday rpl_gettimeofday +# if @GNULIB_GETTIMEOFDAY@ +# if @REPLACE_GETTIMEOFDAY@ +# undef gettimeofday +# define gettimeofday rpl_gettimeofday extern int gettimeofday (struct timeval *restrict, void *restrict) _GL_ARG_NONNULL ((1)); +# endif +# elif defined GNULIB_POSIXCHECK +# undef gettimeofday +# if HAVE_RAW_DECL_GETTIMEOFDAY +_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " + "use gnulib module gettimeofday for portability"); +# endif # endif #ifdef __cplusplus diff --git a/gl/tests/test-getdelim.c b/gl/tests/test-getdelim.c index df9966497e..a5df49f1dd 100644 --- a/gl/tests/test-getdelim.c +++ b/gl/tests/test-getdelim.c @@ -33,13 +33,13 @@ int main (void) { FILE *f; - char *line = NULL; - size_t len = 0; + char *line; + size_t len; ssize_t result; /* Create test file. */ f = fopen ("test-getdelim.txt", "wb"); - if (!f || fwrite ("anbcnd\0f", 1, 8, f) != 8 || fclose (f) != 0) + if (!f || fwrite ("anAnbcnd\0f", 1, 10, f) != 10 || fclose (f) != 0) { fputs ("Failed to create sample file.\n", stderr); remove ("test-getdelim.txt"); @@ -54,13 +54,24 @@ main (void) } /* Test initial allocation, which must include trailing NUL. */ + line = NULL; + len = 0; result = getdelim (&line, &len, 'n', f); ASSERT (result == 2); ASSERT (strcmp (line, "an") == 0); ASSERT (2 < len); + free (line); - /* Test growth of buffer. */ + /* Test initial allocation again, with line = NULL and len != 0. */ + line = NULL; + len = (size_t)(~0) / 4; + result = getdelim (&line, &len, 'n', f); + ASSERT (result == 2); + ASSERT (strcmp (line, "An") == 0); + ASSERT (2 < len); free (line); + + /* Test growth of buffer. */ line = malloc (1); len = 1; result = getdelim (&line, &len, 'n', f); diff --git a/gl/tests/test-getline.c b/gl/tests/test-getline.c index 7112b52a4c..6a661ce530 100644 --- a/gl/tests/test-getline.c +++ b/gl/tests/test-getline.c @@ -33,13 +33,13 @@ int main (void) { FILE *f; - char *line = NULL; - size_t len = 0; + char *line; + size_t len; ssize_t result; /* Create test file. */ f = fopen ("test-getline.txt", "wb"); - if (!f || fwrite ("a\nbc\nd\0f", 1, 8, f) != 8 || fclose (f) != 0) + if (!f || fwrite ("a\nA\nbc\nd\0f", 1, 10, f) != 10 || fclose (f) != 0) { fputs ("Failed to create sample file.\n", stderr); remove ("test-getline.txt"); @@ -54,13 +54,24 @@ main (void) } /* Test initial allocation, which must include trailing NUL. */ + line = NULL; + len = 0; result = getline (&line, &len, f); ASSERT (result == 2); ASSERT (strcmp (line, "a\n") == 0); ASSERT (2 < len); + free (line); - /* Test growth of buffer, must not leak. */ + /* Test initial allocation again, with line = NULL and len != 0. */ + line = NULL; + len = (size_t)(~0) / 4; + result = getline (&line, &len, f); + ASSERT (result == 2); + ASSERT (strcmp (line, "A\n") == 0); + ASSERT (2 < len); free (line); + + /* Test growth of buffer, must not leak. */ line = malloc (1); len = 0; result = getline (&line, &len, f); diff --git a/gl/tests/test-gettimeofday.c b/gl/tests/test-gettimeofday.c index 2a07814bb9..ff2bc72b54 100644 --- a/gl/tests/test-gettimeofday.c +++ b/gl/tests/test-gettimeofday.c @@ -20,7 +20,8 @@ #include <sys/time.h> #include "signature.h" -SIGNATURE_CHECK (gettimeofday, int, (struct timeval *, void *)); +SIGNATURE_CHECK (gettimeofday, int, + (struct timeval *, GETTIMEOFDAY_TIMEZONE *)); #include <time.h> @@ -42,8 +43,5 @@ main (void) fprintf (stderr, "gettimeofday still clobbers the localtime buffer!\n"); return 1; } - else - { - return 0; - } + return 0; } diff --git a/lib/gl/Makefile.am b/lib/gl/Makefile.am index 8bb9f26f79..8b70b06c5d 100644 --- a/lib/gl/Makefile.am +++ b/lib/gl/Makefile.am @@ -466,6 +466,7 @@ stdio.h: stdio.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ + -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ diff --git a/lib/gl/m4/stdio_h.m4 b/lib/gl/m4/stdio_h.m4 index 20af579d14..781fa8d388 100644 --- a/lib/gl/m4/stdio_h.m4 +++ b/lib/gl/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 24 +# stdio_h.m4 serial 25 dnl Copyright (C) 2007-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, @@ -111,6 +111,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) + REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM]) REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR]) diff --git a/lib/gl/netdb.in.h b/lib/gl/netdb.in.h index e16d587a49..05b2f11141 100644 --- a/lib/gl/netdb.in.h +++ b/lib/gl/netdb.in.h @@ -74,18 +74,24 @@ struct addrinfo # endif # if 0 -/* The commented out definitions below are not yet implemented in the - GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact, - cause conflicts on systems with a getaddrinfo() function which does not - define them. - - If they are restored, be sure to protect the definitions with #ifndef. */ # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ -# define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */ -# define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */ -# define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose - returned address type.. */ -# endif /* 0 */ +# endif + +/* These symbolic constants are required to be present by POSIX, but + our getaddrinfo replacement doesn't use them (yet). Setting them + to 0 on systems that doesn't have them avoids causing problems for + system getaddrinfo implementations that would be confused by + unknown values. */ +# ifndef AI_V4MAPPED +# define AI_V4MAPPED 0 /* 0x0008: IPv4 mapped addresses are acceptable. */ +# endif +# ifndef AI_ALL +# define AI_ALL 0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */ +# endif +# ifndef AI_ADDRCONFIG +# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose + returned address type.. */ +# endif /* Error values for `getaddrinfo' function. */ # ifndef EAI_BADFLAGS diff --git a/lib/gl/stdio.in.h b/lib/gl/stdio.in.h index 156d28dcfc..b83bc95fda 100644 --- a/lib/gl/stdio.in.h +++ b/lib/gl/stdio.in.h @@ -340,7 +340,11 @@ extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream) #endif #if @GNULIB_GETDELIM@ -# if !@HAVE_DECL_GETDELIM@ +# if @REPLACE_GETDELIM@ +# undef getdelim +# define getdelim rpl_getdelim +# endif +# if !@HAVE_DECL_GETDELIM@ || @REPLACE_GETDELIM@ /* Read input, up to (and including) the next occurrence of DELIMITER, from STREAM, store it in *LINEPTR (and NUL-terminate it). *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE @@ -382,7 +386,7 @@ _GL_WARN_ON_USE (getline, "getline is unportable - " # endif #endif -#if @GNULIB_OBSTACK_PRINTF@ +#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ # if @REPLACE_OBSTACK_PRINTF@ # define obstack_printf rpl_osbtack_printf # define obstack_vprintf rpl_obstack_vprintf @@ -125,7 +125,9 @@ local-checks-available = \ # Arrange to print the name of each syntax-checking rule just before running it. $(syntax-check-rules): %: %.m -$(patsubst %, %.m, $(syntax-check-rules)): +sc_m_rules_ = $(patsubst %, %.m, $(syntax-check-rules)) +.PHONY: $(sc_m_rules_) +$(sc_m_rules_): @echo $(patsubst sc_%.m, %, $@) local-check := $(filter-out $(local-checks-to-skip), $(local-checks-available)) @@ -334,6 +336,11 @@ sc_prohibit_inttostr_without_use: $(_header_without_use) # Don't include this header unless you use one of its functions. +sc_prohibit_ignore_value_without_use: + @h='"ignore-value.h"' re='\<ignore_(value|ptr) *\(' \ + $(_header_without_use) + +# Don't include this header unless you use one of its functions. sc_prohibit_error_without_use: @h='"error.h"' \ re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\ @@ -362,6 +369,22 @@ sc_prohibit_xalloc_without_use: re='\<($(_xa1)|$(_xa2)) *\('\ $(_header_without_use) +# Extract function names: +# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) \(/ and print $1' lib/hash.h +_hash_re = \ +clear|delete|free|get_(first|next)|insert|lookup|print_statistics|reset_tuning +_hash_fn = \<($(_hash_re)) *\( +_hash_struct = (struct )?\<[Hh]ash_(table|tuning)\> +sc_prohibit_hash_without_use: + @h='"hash.h"' \ + re='$(_hash_fn)|$(_hash_struct)'\ + $(_header_without_use) + +sc_prohibit_hash_pjw_without_use: + @h='"hash-pjw.h"' \ + re='\<hash_pjw *\(' \ + $(_header_without_use) + sc_prohibit_safe_read_without_use: @h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \ $(_header_without_use) @@ -726,6 +749,19 @@ sc_Wundef_boolean: @grep -Ei '^#define.*(yes|no|true|false)$$' '$(CONFIG_INCLUDE)' && \ { echo 'Use 0 or 1 for macro values' 1>&2; exit 1; } || : +sc_vulnerable_makefile_CVE-2009-4029: + @files=$$(find $(srcdir) -name Makefile.in); \ + if test -n "$$files"; then \ + grep -E \ + 'perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)' \ + $$files && \ + { echo '$(ME): the above files are vulnerable; beware of' \ + 'running "make dist*" rules, and upgrade to fixed automake' \ + 'see http://bugzilla.redhat.com/542609 for details' \ + 1>&2; exit 1; } || :; \ + else :; \ + fi + vc-diff-check: (unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || : if test -s vc-diffs; then \ @@ -769,11 +805,12 @@ announcement: NEWS ChangeLog $(rel-files) ftp-gnu = ftp://ftp.gnu.org/gnu www-gnu = http://www.gnu.org +upload_dest_dir_ ?= $(PACKAGE) emit_upload_commands: @echo ===================================== @echo ===================================== @echo "$(build_aux)/gnupload $(GNUPLOADFLAGS) \\" - @echo " --to $(gnu_rel_host):$(PACKAGE) \\" + @echo " --to $(gnu_rel_host):$(upload_dest_dir_) \\" @echo " $(rel-files)" @echo '# send the ~/announce-$(my_distdir) e-mail' @echo ===================================== |