bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with create_pipe_bidi


From: Eric Blake
Subject: Re: Help with create_pipe_bidi
Date: Sat, 18 Jul 2009 08:31:34 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[dropping bug-gnulib]

According to Eric Blake on 7/18/2009 8:27 AM:
> 
> Eric Blake (5):
>       Merge commit 'origin' into create-pipe-bidi
>       Clean up non-recursive make.
>       Import latest m4/m4.m4.
>       Import latest bootstrap script.
>       Use pipe module for more robust m4 subprocess.

Here's the patch in email form, for review:

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

Eric Blake             address@hidden
-----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

iEYEARECAAYFAkph3MUACgkQ84KuGfSFAYAQngCdF0s3t2PRVCtEDcGiiY6pkKus
vFwAoKsIA7VHD0vWOa9rA3Er74vwDdb7
=aYGP
-----END PGP SIGNATURE-----
>From bc36a8822bc278b90f76a4c38f5bc6db1f8d6b4f Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 17 Jul 2009 21:00:47 -0600
Subject: [PATCH 1/4] Clean up non-recursive make.

* configure.ac: Don't rename headers that aren't built.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog    |    5 +++++
 configure.ac |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9ae99b0..acd98b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-17  Eric Blake  <address@hidden>
+
+       Clean up non-recursive make.
+       * configure.ac: Don't rename headers that aren't built.
+
 2009-07-15  Joel E. Denny  <address@hidden>

        Revert unnecessary column realignment in --help output.
diff --git a/configure.ac b/configure.ac
index 64af9cd..fa2a8e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,7 +151,7 @@ gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, , lib/,g'`
 for ac_var in ALLOCA_H ERRNO_H FCNTL_H GETOPT_H INTTYPES_H \
               STDBOOL_H STDINT_H SYS_WAIT_H WCHAR_H WCTYPE_H
 do
-  eval "$ac_var=lib/\$$ac_var"
+  eval "test 'x$ac_var' = x || $ac_var=lib/\$$ac_var"
 done
 AC_CONFIG_FILES([Makefile
                 po/Makefile.in
-- 
1.6.3.3.334.g916e1


>From 4be36955e59b878adcb3231b445a71a6b4417e77 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Fri, 17 Jul 2009 22:15:27 -0600
Subject: [PATCH 2/4] Import latest m4/m4.m4.

* submodules/autoconf: Update.
* configure.ac (M4_GNU_OPTION): New define.
* src/output.c (output_skeleton): Use it to resolve FIXME.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog           |   21 ++++++++++++++-------
 configure.ac        |    2 ++
 src/output.c        |   33 ++++++++++++++-------------------
 submodules/autoconf |    2 +-
 4 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index acd98b8..b37c448 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-18  Eric Blake  <address@hidden>
+
+       Import latest m4/m4.m4.
+       * submodules/autoconf: Update.
+       * configure.ac (M4_GNU_OPTION): New define.
+       * src/output.c (output_skeleton): Use it to resolve FIXME.
+
 2009-07-17  Eric Blake  <address@hidden>

        Clean up non-recursive make.
@@ -166,13 +173,13 @@
 2009-06-10  Akim Demaille  <address@hidden>

        gnulib: update.
-        * gnulib: Update to latest.
-        * lib/.cvsignore, lib/.gitignore, m4/.cvsignore,
-        * m4/.gitignore: Regen.
-        * src/symtab.c (symbol_from_uniqstr, semantic_type_from_uniqstr):
-        Call xalloc_die on hash_insert failures.
-        Requested by the new __warn_unused_result__ attribute of
-        hash_insert.
+       * gnulib: Update to latest.
+       * lib/.cvsignore, lib/.gitignore, m4/.cvsignore,
+       * m4/.gitignore: Regen.
+       * src/symtab.c (symbol_from_uniqstr, semantic_type_from_uniqstr):
+       Call xalloc_die on hash_insert failures.
+       Requested by the new __warn_unused_result__ attribute of
+       hash_insert.

 2009-06-10  Akim Demaille  <address@hidden>

diff --git a/configure.ac b/configure.ac
index fa2a8e2..eda5881 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,6 +94,8 @@ AC_PROG_YACC
 AC_PROG_RANLIB
 AC_PROG_GNU_M4
 AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
+AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
+supports -g, otherwise to "".])
 AM_MISSING_PROG([HELP2MAN], [help2man])
 AC_PATH_PROG([XSLTPROC], [xsltproc])
 AC_SUBST([XSLTPROC])
diff --git a/src/output.c b/src/output.c
index c5e9aab..5f2d150 100644
--- a/src/output.c
+++ b/src/output.c
@@ -562,7 +562,7 @@ output_skeleton (void)
 {
   FILE *in;
   int filter_fd[2];
-  char const *argv[9];
+  char const *argv[10];
   pid_t pid;

   /* Compute the names of the package data dir and skeleton files.  */
@@ -613,6 +613,19 @@ output_skeleton (void)
   {
     int i = 0;
     argv[i++] = m4;
+
+    /* When POSIXLY_CORRECT is set, GNU M4 1.6 and later disable GNU
+       extensions, which Bison's skeletons depend on.  With older M4,
+       it has no effect.  M4 1.4.12 added a -g/--gnu command-line
+       option to make it explicit that a program wants GNU M4
+       extensions even when POSIXLY_CORRECT is set.
+
+       See the thread starting at
+       <http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
+       for details.  */
+    if (*M4_GNU_OPTION)
+      argv[i++] = M4_GNU_OPTION;
+
     argv[i++] = "-I";
     argv[i++] = pkgdatadir;
     if (trace_flag & trace_m4)
@@ -623,25 +636,7 @@ output_skeleton (void)
     argv[i++] = full_skeleton;
     argv[i++] = NULL;
   }
-  /* When POSIXLY_CORRECT is set, some future versions of GNU M4 (most likely
-     2.0) may drop some of the GNU extensions that Bison's skeletons depend
-     upon.  So that the next release of Bison is forward compatible with those
-     future versions of GNU M4, we unset POSIXLY_CORRECT here.
-
-     FIXME: A user might set POSIXLY_CORRECT to affect processes run from
-     macros like m4_syscmd in a custom skeleton.  For now, Bison makes no
-     promises about the behavior of custom skeletons, so this scenario is not a
-     concern.  However, we eventually want to eliminate this shortcoming.  The
-     next release of GNU M4 (1.4.12 or 1.6) will accept the -g command-line
-     option as a no-op, and later releases will accept it to indicate that
-     POSIXLY_CORRECT should be ignored.  Once the GNU M4 versions that accept
-     -g are pervasive, Bison should use -g instead of unsetting
-     POSIXLY_CORRECT.

-     See the thread starting at
-     <http://lists.gnu.org/archive/html/bug-bison/2008-07/msg00000.html>
-     for details.  */
-  unsetenv ("POSIXLY_CORRECT");
   init_subpipe ();
   pid = create_subpipe (argv, filter_fd);
   free (full_m4sugar);
diff --git a/submodules/autoconf b/submodules/autoconf
index ef8940d..497a186 160000
--- a/submodules/autoconf
+++ b/submodules/autoconf
@@ -1 +1 @@
-Subproject commit ef8940d9b5a3fe2866027f82a535915da3e78829
+Subproject commit 497a186732392d9ae297125071fc11794d364fcb
-- 
1.6.3.3.334.g916e1


>From 87a05fd87480aa2695e248346d293d9f263537a8 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Sat, 18 Jul 2009 06:24:59 -0600
Subject: [PATCH 3/4] Import latest bootstrap script.

* gnulib: Update.
* bootstrap: Copy from gnulib, plus a one-line change.
* bootstrap.conf (checkout_only_file): New variable.
* .gitignore, lib/.cvsignore, lib/.gitignore, m4/.cvsignore,
* m4/.gitignore, build-aux/.gitignore, doc/.gitignore,
* po/.gitignore: Regen.

Signed-off-by: Eric Blake <address@hidden>
---
 .gitignore           |    4 +
 ChangeLog            |    8 +
 bootstrap            |  557 +++++++++++++++++++++++++++++---------------------
 bootstrap.conf       |    3 +
 build-aux/.gitignore |    7 +
 doc/.gitignore       |    1 +
 gnulib               |    2 +-
 lib/.cvsignore       |    4 +
 lib/.gitignore       |   95 +++++++++
 m4/.cvsignore        |    2 +
 m4/.gitignore        |   77 +++++++
 po/.gitignore        |   11 +
 12 files changed, 535 insertions(+), 236 deletions(-)

diff --git a/.gitignore b/.gitignore
index be0a7b7..6d46a77 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,9 +23,13 @@
 /configure
 /configure.lineno
 /conftest*
+/doc/Doxyfile
+/doc/html
 /gnulib
 /javacomp.sh
 /javaexec.sh
 /patches
 /releases
 /stamp-h*
+ABOUT-NLS
+.dirstamp
diff --git a/ChangeLog b/ChangeLog
index b37c448..9b96bf2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-07-18  Eric Blake  <address@hidden>

+       Import latest bootstrap script.
+       * gnulib: Update.
+       * bootstrap: Copy from gnulib, plus a one-line change.
+       * bootstrap.conf (checkout_only_file): New variable.
+       * .gitignore, lib/.cvsignore, lib/.gitignore, m4/.cvsignore,
+       * m4/.gitignore, build-aux/.gitignore, doc/.gitignore,
+       * po/.gitignore: Regen.
+
        Import latest m4/m4.m4.
        * submodules/autoconf: Update.
        * configure.ac (M4_GNU_OPTION): New define.
diff --git a/bootstrap b/bootstrap
index 031ecf7..d08ac7a 100755
--- a/bootstrap
+++ b/bootstrap
@@ -2,8 +2,7 @@

 # Bootstrap this package from checked-out sources.

-# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 2003-2009 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
@@ -24,7 +23,6 @@ nl='
 '

 # Ensure file names are sorted consistently across platforms.
-# Also, ensure diagnostics are in English, e.g., "wget --help" below.
 LC_ALL=C
 export LC_ALL

@@ -36,28 +34,29 @@ bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
 bt2=${bt}2

 usage() {
-  cat <<EOF
+  echo >&2 "\
 Usage: $0 [OPTION]...
 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.
+                          sources reside.  Use this if you already
+                          have gnulib sources on your machine, and
+                          do not want to waste your bandwidth downloading
+                          them again.
  --copy                   Copy files instead of creating symbolic links.
  --force                  Attempt to bootstrap even if the sources seem
-                         not to have been checked out.
+                          not to have been checked out.
  --skip-po                Do not download po files.
- --cvs-user=USERNAME      Set the username to use when checking out
-                         sources from the gnulib repository.

-If the file bootstrap.conf exists in the current working directory, its
+If the file $0.conf exists in the same directory as this script, its
 contents are read as shell variables to configure the bootstrap.

+For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
+are honored.
+
 Running without arguments will suffice in most cases.
-EOF
+"
 }

 # Configuration.
@@ -81,9 +80,10 @@ po_download_command_format=\

 extract_package_name='
   /^AC_INIT(/{
-     /.*,.*,.*,/{
+     /.*,.*,.*, */{
        s///
        s/[][]//g
+       s/)$//
        p
        q
      }
@@ -99,16 +99,21 @@ package=`sed -n "$extract_package_name" configure.ac` || 
exit
 gnulib_name=lib$package

 build_aux=build-aux
+source_base=lib
+m4_base=m4
+doc_base=doc
+tests_base=tests
+
 # Extra files from gnulib, which override files from other sources.
 gnulib_extra_files="
-       $build_aux/install-sh
-       $build_aux/missing
-       $build_aux/mdate-sh
-       $build_aux/texinfo.tex
-       $build_aux/depcomp
-       $build_aux/config.guess
-       $build_aux/config.sub
-       doc/INSTALL
+        $build_aux/install-sh
+        $build_aux/missing
+        $build_aux/mdate-sh
+        $build_aux/texinfo.tex
+        $build_aux/depcomp
+        $build_aux/config.guess
+        $build_aux/config.sub
+        doc/INSTALL
 "

 # Additional gnulib-tool options to use.  Use "\newline" to break lines.
@@ -124,12 +129,15 @@ XGETTEXT_OPTIONS='\\\
  --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
 '

+# Package bug report address for gettext files
address@hidden
+
 # Files we don't want to import.
 excluded_files=

 # File that should exist in the top directory of a checked out hierarchy,
 # but not in a distribution tarball.
-checkout_only_file=HACKING
+checkout_only_file=README-hacking

 # Whether to use copies instead of symlinks.
 copy=false
@@ -140,39 +148,14 @@ copy=false
 # on which version control system (if any) is used in the source directory.
 vc_ignore=auto

-# find_tool ENVVAR NAMES...
-# -------------------------
-find_tool ()
-{
-  find_tool_envvar=$1
-  shift
-  find_tool_name=$@
-  if eval test x"\$$find_tool_envvar" = x; then
-    for i
-    do
-      if ($i --version </dev/null) >/dev/null 2>&1; then
-       find_tool_res=$i
-       break
-      fi
-    done
-  fi
-  if test x"$find_tool_res" = x; then
-    echo >&2 "$0: one of these is required: $find_tool_names"
-    exit 1
-  fi
-  ($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
-    echo >&2 "$0: cannot run $find_tool_res --version"
-    exit 1
-  }
-  eval "$find_tool_envvar=\"$find_tool_res\""
-  eval "export $find_tool_envvar"
-}
-
-# Find sha1sum, named gsha1sum on MacPorts.
-find_tool SHA1SUM sha1sum gsha1sum
-
 # Override the default configuration, if necessary.
-test -r bootstrap.conf && . ./bootstrap.conf
+# Make sure that bootstrap.conf is sourced from the current directory
+# if we were invoked as "sh bootstrap".
+case "$0" in
+  */*) test -r "$0.conf" && . "$0.conf" ;;
+  *) test -r "$0.conf" && . ./"$0.conf" ;;
+esac
+

 if test "$vc_ignore" = auto; then
   vc_ignore=
@@ -191,9 +174,7 @@ do
     usage
     exit;;
   --gnulib-srcdir=*)
-    GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
-  --cvs-user=*)
-    CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
+    GNULIB_SRCDIR=`expr "X$option" : 'X--gnulib-srcdir=\(.*\)'`;;
   --skip-po)
     SKIP_PO=t;;
   --force)
@@ -211,32 +192,17 @@ if test -n "$checkout_only_file" && test ! -r 
"$checkout_only_file"; then
   exit 1
 fi

-# If each line in $STR is not already on a line by itself in $FILE, insert it,
+# If $STR is not already on a line by itself in $FILE, insert it,
 # sorting the new contents of the file and replacing $FILE with the result.
 insert_sorted_if_absent() {
   file=$1
   str=$2
   test -f $file || touch $file
-  echo "$str" | sort -u - $file | cmp -s - $file \
+  echo "$str" | sort -u - $file | cmp - $file > /dev/null \
     || echo "$str" | sort -u - $file -o $file \
     || exit 1
 }

-# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
-# insert_sorted_if_absent.
-insert_vc_ignore() {
-  vc_ignore_file="$1"
-  case $vc_ignore_file in
-  *.gitignore)
-    # A .gitignore entry that does not start with `/' applies recursively to
-    # subdirectories, so prepend `/' to every .gitignore entry.
-    pattern=`echo "$2" | sed s,^,/,`;;
-  *)
-    pattern="$2";;
-  esac
-  insert_sorted_if_absent "$vc_ignore_file" "$pattern"
-}
-
 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
 found_aux_dir=no
 grep '^[        ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
@@ -255,20 +221,107 @@ if test ! -d $build_aux; then
   mkdir $build_aux
   for dot_ig in x $vc_ignore; do
     test $dot_ig = x && continue
-    insert_vc_ignore $dot_ig $build_aux
+    insert_sorted_if_absent $dot_ig $build_aux
   done
 fi

-echo "$0: Bootstrapping from checked-out $package sources..."
+# Note this deviates from the version comparison in automake
+# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
+# but this should suffice as we won't be specifying old
+# version formats or redundant trailing .0 in bootstrap.conf.
+# If we did want full compatibility then we should probably
+# use m4_version_compare from autoconf.
+sort_ver() { # sort -V is not generally available
+  ver1="$1"
+  ver2="$2"
+
+  # split on '.' and compare each component
+  i=1
+  while : ; do
+    p1=$(echo "$ver1" | cut -d. -f$i)
+    p2=$(echo "$ver2" | cut -d. -f$i)
+    if [ ! "$p1" ]; then
+      echo "$1 $2"
+      break
+    elif [ ! "$p2" ]; then
+      echo "$2 $1"
+      break
+    elif [ ! "$p1" = "$p2" ]; then
+      if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison
+        echo "$2 $1"
+      elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
+        echo "$1 $2"
+      else # numeric, then lexicographic comparison
+        lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
+        if [ "$lp" = "$p2" ]; then
+          echo "$1 $2"
+        else
+          echo "$2 $1"
+        fi
+      fi
+      break
+    fi
+    i=$(($i+1))
+  done
+}

-cleanup_gnulib() {
-  status=$?
-  rm -fr gnulib
-  exit $status
+get_version() {
+  app=$1
+
+  $app --version >/dev/null 2>&1 || return 1
+
+  $app --version 2>&1 |
+  sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
+          t done
+          d
+          :done
+          q'
 }

-# See if we can use gnulib's git-merge-changelog merge driver.
+check_versions() {
+  ret=0
+
+  while read app req_ver; do
+    # Honor $APP variables ($TAR, $AUTOCONF, etc.)
+    appvar=`echo $app | tr '[a-z]' '[A-Z]'`
+    test "$appvar" = TAR && appvar=AMTAR
+    eval "app=\${$appvar-$app}"
+    inst_ver=$(get_version $app)
+    if [ ! "$inst_ver" ]; then
+      echo "Error: '$app' not found" >&2
+      ret=1
+    elif [ ! "$req_ver" = "-" ]; then
+      latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
+      if [ ! "$latest_ver" = "$inst_ver" ]; then
+        echo "Error: '$app' version == $inst_ver is too old" >&2
+        echo "       '$app' version >= $req_ver is required" >&2
+        ret=1
+      fi
+    fi
+  done
+
+  return $ret
+}
+
+print_versions() {
+  echo "Program    Min_version"
+  echo "----------------------"
+  printf "$buildreq"
+  echo "----------------------"
+  # can't depend on column -t
+}

+if ! printf "$buildreq" | check_versions; then
+  test -f README-prereq &&
+  echo "See README-prereq for notes on obtaining these prerequisite programs:" 
>&2
+  echo
+  print_versions
+  exit 1
+fi
+
+echo "$0: Bootstrapping from checked-out $package sources..."
+
+# See if we can use gnulib's git-merge-changelog merge driver.
 if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
   if git config merge.merge-changelog.driver >/dev/null ; then
     :
@@ -281,35 +334,52 @@ if test -d .git && (git --version) >/dev/null 2>/dev/null 
; then
   fi
 fi

+
+cleanup_gnulib() {
+  status=$?
+  rm -fr gnulib
+  exit $status
+}
+
+git_modules_config () {
+  test -f .gitmodules && git config --file .gitmodules "$@"
+}
+
 # Get gnulib files.

 case ${GNULIB_SRCDIR--} in
 -)
-  if [ ! -d gnulib ]; then
+  if git_modules_config submodule.gnulib.url >/dev/null; then
     echo "$0: getting gnulib files..."
+    git submodule init || exit $?
+    git submodule update || exit $?

-    case ${CVS_AUTH-pserver} in
-    pserver)
-      CVS_PREFIX=':pserver:anonymous@';;
-    ssh)
-      CVS_PREFIX="address@hidden";;
-    *)
-      echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
-      exit 1;;
-    esac
-
-    case $CVS_RSH in
-    '') CVS_RSH=ssh; export CVS_RSH;;
-    esac
+  elif [ ! -d gnulib ]; then
+    echo "$0: getting gnulib files..."

     trap cleanup_gnulib 1 2 13 15

-    cvs -z3 -q -d ${CVS_PREFIX}pserver.git.sv.gnu.org:/gnulib.git co -d gnulib 
HEAD ||
+    git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
+    git clone $shallow git://git.sv.gnu.org/gnulib ||
       cleanup_gnulib

     trap - 1 2 13 15
   fi
   GNULIB_SRCDIR=gnulib
+  ;;
+*)
+  # Redirect the gnulib submodule to the directory on the command line
+  # if possible.
+  if test -d "$GNULIB_SRCDIR"/.git && \
+        git_modules_config submodule.gnulib.url >/dev/null; then
+    git submodule init
+    GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
+    git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
+    echo "$0: getting gnulib files..."
+    git submodule update || exit $?
+    GNULIB_SRCDIR=gnulib
+  fi
+  ;;
 esac

 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
@@ -342,13 +412,20 @@ update_po_files() {
     && ls "$ref_po_dir"/*.po 2>/dev/null |
       sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"

-  for po in `cd $ref_po_dir && echo *.po|sed 's/\.po//g'`; do
-     new_po="$ref_po_dir/$po.po"
-     cksum_file="$ref_po_dir/$po.s1"
-     if ! "$SHA1SUM" -c --status "$cksum_file" < "$new_po" > /dev/null; then
-       echo "updated $po_dir/$po.po..."
-       cp "$new_po" "$po_dir/$po.po" && "$SHA1SUM" < "$new_po" > "$cksum_file"
-     fi
+  langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
+  test "$langs" = '*' && langs=x
+  for po in $langs; do
+    case $po in x) continue;; esac
+    new_po="$ref_po_dir/$po.po"
+    cksum_file="$ref_po_dir/$po.s1"
+    if ! test -f "$cksum_file" ||
+        ! test -f "$po_dir/$po.po" ||
+        ! ${SHA1SUM-sha1sum} -c --status "$cksum_file" \
+            < "$new_po" > /dev/null; then
+      echo "updated $po_dir/$po.po..."
+      cp "$new_po" "$po_dir/$po.po" \
+          && ${SHA1SUM-sha1sum} < "$new_po" > "$cksum_file"
+    fi
   done
 }

@@ -363,27 +440,6 @@ case $SKIP_PO in
   fi;;
 esac

-check_dst_dir()
-{
-  dst=$1
-  # If the destination directory doesn't exist, create it.
-  # This is required at least for "lib/uniwidth/cjk.h".
-  dst_dir=`dirname "$dst"`
-  if ! test -d "$dst_dir"; then
-    mkdir -p "$dst_dir"
-
-    # If we've just created a directory like lib/uniwidth,
-    # tell version control system(s) it's ignorable.
-    # FIXME: for now, this does only one level
-    parent=`dirname "$dst_dir"`
-    for dot_ig in x $vc_ignore; do
-      test $dot_ig = x && continue
-      ig=$parent/$dot_ig
-      insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'`
-    done
-  fi
-}
-
 symlink_to_dir()
 {
   src=$1/$2
@@ -391,41 +447,56 @@ symlink_to_dir()

   test -f "$src" && {

-    check_dst_dir "$dst"
+    # If the destination directory doesn't exist, create it.
+    # This is required at least for "lib/uniwidth/cjk.h".
+    dst_dir=`dirname "$dst"`
+    if ! test -d "$dst_dir"; then
+      mkdir -p "$dst_dir"
+
+      # If we've just created a directory like lib/uniwidth,
+      # tell version control system(s) it's ignorable.
+      # FIXME: for now, this does only one level
+      parent=`dirname "$dst_dir"`
+      for dot_ig in x $vc_ignore; do
+        test $dot_ig = x && continue
+        ig=$parent/$dot_ig
+        insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
+      done
+    fi

     if $copy; then
       {
-       test ! -h "$dst" || {
-         echo "$0: rm -f $dst" &&
-         rm -f "$dst"
-       }
+        test ! -h "$dst" || {
+          echo "$0: rm -f $dst" &&
+          rm -f "$dst"
+        }
       } &&
       test -f "$dst" &&
       cmp -s "$src" "$dst" || {
-       echo "$0: cp -fp $src $dst" &&
-       cp -fp "$src" "$dst"
+        echo "$0: cp -fp $src $dst" &&
+        cp -fp "$src" "$dst"
       }
     else
       test -h "$dst" &&
       src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
       dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
       test "$src_i" = "$dst_i" || {
-       dot_dots=
-       case $src in
-       /*) ;;
-       *)
-         case /$dst/ in
-         *//* | */../* | */./* | /*/*/*/*/*/)
-            echo >&2 "$0: invalid symlink calculation: $src -> $dst"
-            exit 1;;
-         /*/*/*/*/)    dot_dots=../../../;;
-         /*/*/*/)      dot_dots=../../;;
-         /*/*/)        dot_dots=../;;
-         esac;;
-       esac
-
-       echo "$0: ln -fs $dot_dots$src $dst" &&
-       ln -fs "$dot_dots$src" "$dst"
+        dot_dots=
+        case $src in
+        /*) ;;
+        *)
+          case /$dst/ in
+          *//* | */../* | */./* | /*/*/*/*/*/)
+             echo >&2 "$0: invalid symlink calculation: $src -> $dst"
+             exit 1;;
+          /*/*/*/*/)   dot_dots=../../../;;
+          /*/*/*/)     dot_dots=../../;;
+          /*/*/)       dot_dots=../;;
+          esac;;
+        esac
+
+        echo "$0: ln -fs $dot_dots$src $dst" &&
+        ln -fs "$dot_dots$src" "$dst"
       }
     fi
   }
@@ -448,27 +519,35 @@ cp_mark_as_generated()
       *)                  c1=     ; c2=     ;;
     esac

+    # If the destination directory doesn't exist, create it.
+    # This is required at least for "lib/uniwidth/cjk.h".
+    dst_dir=`dirname "$cp_dst"`
+    test -d "$dst_dir" || mkdir -p "$dst_dir"
+
     if test -z "$c1"; then
       cmp -s "$cp_src" "$cp_dst" || {
-       echo "$0: cp -f $cp_src $cp_dst" &&
-       rm -f "$cp_dst" &&
-       sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst"
+        # Copy the file first to get proper permissions if it
+        # doesn't already exist.  Then overwrite the copy.
+        echo "$0: cp -f $cp_src $cp_dst" &&
+        rm -f "$cp_dst" &&
+        cp "$cp_src" "$cp_dst-t" &&
+        sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
+        mv -f "$cp_dst-t" "$cp_dst"
       }
     else
-      check_dst_dir "$cp_dst"
       # Copy the file first to get proper permissions if it
       # doesn't already exist.  Then overwrite the copy.
       cp "$cp_src" "$cp_dst-t" &&
       (
-       echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
-       echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
-       sed "s!$bt_regex/!!g" "$cp_src"
+        echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
+        echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
+        sed "s!$bt_regex/!!g" "$cp_src"
       ) > $cp_dst-t &&
       if cmp -s "$cp_dst-t" "$cp_dst"; then
-       rm -f "$cp_dst-t"
+        rm -f "$cp_dst-t"
       else
-       echo "$0: cp $cp_src $cp_dst # with edits" &&
-       mv -f "$cp_dst-t" "$cp_dst"
+        echo "$0: cp $cp_src $cp_dst # with edits" &&
+        mv -f "$cp_dst-t" "$cp_dst"
       fi
     fi
   fi
@@ -480,9 +559,11 @@ version_controlled_file() {
   found=no
   if test -d CVS; then
     grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
-            grep '^/[^/]*/[0-9]' > /dev/null && found=yes
+             grep '^/[^/]*/[0-9]' > /dev/null && found=yes
   elif test -d .git; then
-    git-rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
+    git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
+  elif test -d .svn; then
+    svn log -r HEAD "$dir/$file" > /dev/null 2>&1 && found=yes
   else
     echo "$0: no version control for $dir/$file?" >&2
   fi
@@ -500,34 +581,36 @@ slurp() {
       esac
       test -d $1/$dir/$file && continue
       for excluded_file in $excluded_files; do
-       test "$dir/$file" = "$excluded_file" && continue 2
+        test "$dir/$file" = "$excluded_file" && continue 2
       done
       if test $file = Makefile.am; then
-       copied=$copied${sep}$gnulib_mk; sep=$nl
-       remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
-       echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..."
-       rm -f $dir/$gnulib_mk
-       sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
+        copied=$copied${sep}$gnulib_mk; sep=$nl
+        remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
+        sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null 
|| {
+          echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
+          rm -f $dir/$gnulib_mk &&
+          sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
+        }
         etc/prefix-gnulib-mk $dir/$gnulib_mk
       elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
-          version_controlled_file $dir $file; then
-       echo "$0: $dir/$file overrides $1/$dir/$file"
+           version_controlled_file $dir $file; then
+        echo "$0: $dir/$file overrides $1/$dir/$file"
       else
-       copied=$copied$sep$file; sep=$nl
-       if test $file = gettext.m4; then
-         echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
-         rm -f $dir/$file
-         sed '
-           /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
-             AC_DEFUN([AM_INTL_SUBDIR], [
-           /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
-             AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
-           $a\
-             AC_DEFUN([gl_LOCK_EARLY], [])
-         ' $1/$dir/$file >$dir/$file
-       else
-         cp_mark_as_generated $1/$dir/$file $dir/$file
-       fi
+        copied=$copied$sep$file; sep=$nl
+        if test $file = gettext.m4; then
+          echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
+          rm -f $dir/$file
+          sed '
+            /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
+              AC_DEFUN([AM_INTL_SUBDIR], [
+            /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
+              AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
+            $a\
+              AC_DEFUN([gl_LOCK_EARLY], [])
+          ' $1/$dir/$file >$dir/$file
+        else
+          cp_mark_as_generated $1/$dir/$file $dir/$file
+        fi
       fi || exit
     done

@@ -535,18 +618,18 @@ slurp() {
       test $dot_ig = x && continue
       ig=$dir/$dot_ig
       if test -n "$copied"; then
-       insert_vc_ignore $ig "$copied"
-       # If an ignored file name ends with _.h, then also add
-       # the name with just ".h".  Many gnulib headers are generated,
-       # e.g., stdint_.h -> stdint.h, dirent_.h ->..., etc.
-       # Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
-       f=`echo "$copied"|sed 
's/_\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
-       insert_vc_ignore $ig "$f"
-
-       # For files like sys_stat_.h and sys_time_.h, record as
-       # ignorable the directory we might eventually create: sys/.
-       f=`echo "$copied"|sed 's/sys_.*_\.h$/sys/'`
-       insert_vc_ignore $ig "$f"
+        insert_sorted_if_absent $ig "$copied"
+        # If an ignored file name ends with .in.h, then also add
+        # the name with just ".h".  Many gnulib headers are generated,
+        # e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
+        # Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
+        f=`echo "$copied"|sed 
's/\.in\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
+        insert_sorted_if_absent $ig "$f"
+
+        # For files like sys_stat.in.h and sys_time.in.h, record as
+        # ignorable the directory we might eventually create: sys/.
+        f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
+        insert_sorted_if_absent $ig "$f"
       fi
     done
   done
@@ -563,13 +646,13 @@ gnulib_tool_options="\
  --import\
  --no-changelog\
  --aux-dir $bt/$build_aux\
- --doc-base $bt/doc\
+ --doc-base $bt/$doc_base\
  --lib $gnulib_name\
- --m4-base $bt/m4/\
- --source-base $bt/lib/\
- --tests-base $bt/tests\
+ --m4-base $bt/$m4_base/\
+ --source-base $bt/$source_base/\
+ --tests-base $bt/$tests_base\
  --local-dir $local_gl_dir\
-$gnulib_tool_option_extras\
+ $gnulib_tool_option_extras\
 "
 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
 $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
@@ -586,46 +669,46 @@ grep '^[   ]*AM_GNU_GETTEXT_VERSION(' configure.ac 
>/dev/null || \
     with_gettext=no

 if test $with_gettext = yes; then
-  echo "$0: (cd $bt2; autopoint) ..."
+  echo "$0: (cd $bt2; ${AUTOPOINT-autopoint}) ..."
   cp configure.ac $bt2 &&
-  (cd $bt2 && autopoint && rm configure.ac) &&
+  (cd $bt2 && ${AUTOPOINT-autopoint} && rm configure.ac) &&
   slurp $bt2 $bt || exit
-
-  rm -fr $bt $bt2 || exit
-fi
-
-# Coreutils is unusual in that it generates some of its test-related
-# Makefile.am files.  That must be done before invoking automake.
-mam_template=tests/Makefile.am.in
-if test -f $mam_template; then
-  PERL=perl
-  for tool in cut head join pr sort tac tail test tr uniq wc; do
-    m=tests/$tool/Makefile.am
-    t=${m}t
-    rm -f $m $t
-    sed -n '1,/^##test-files-begin/p' $mam_template > $t
-    echo "x = $tool" >> $t
-    srcdir=tests/$tool
-    $PERL -I$srcdir -w -- tests/mk-script $srcdir --list >> $t
-    sed -n '/^##test-files-end/,$p' $mam_template >> $t
-    chmod -w $t
-    mv $t $m
-  done
 fi
+rm -fr $bt $bt2 || exit
+
+# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
+# gnulib-populated directories.  Such .m4 files would cause aclocal to fail.
+# The following requires GNU find 4.2.3 or newer.  Considering the usual
+# portability constraints of this script, that may seem a very demanding
+# requirement, but it should be ok.  Ignore any failure, which is fine,
+# since this is only a convenience to help developers avoid the relatively
+# unusual case in which a symlinked-to .m4 file is git-removed from gnulib
+# between successive runs of this script.
+find "$m4_base" "$source_base" \
+  -depth \( -name '*.m4' -o -name '*.[ch]' \) \
+  -type l -xtype l -delete > /dev/null 2>&1

 # Reconfigure, getting other files.

 for command in \
   libtool \
-  'aclocal --force -I m4' \
-  'autoconf --force' \
-  'autoheader --force' \
-  'automake --add-missing --copy --force-missing';
+  "${ACLOCAL-aclocal} --force -I m4" \
+  "${AUTOCONF-autoconf} --force" \
+  "${AUTOHEADER-autoheader} --force" \
+  "${AUTOMAKE-automake} --add-missing --copy --force-missing"
 do
   if test "$command" = libtool; then
-    grep '^[    ]*AM_PROG_LIBTOOL\>' configure.ac >/dev/null ||
-      continue
-    command='libtoolize -c -f'
+    use_libtool=0
+    # We'd like to use grep -E, to see if any of LT_INIT,
+    # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
+    # but that's not portable enough (e.g., for Solaris).
+    grep '^[    ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
+      && use_libtool=1
+    grep '^[    ]*LT_INIT' configure.ac >/dev/null \
+      && use_libtool=1
+    test $use_libtool = 0 \
+      && continue
+    command="${LIBTOOLIZE-libtoolize} -c -f"
   fi
   echo "$0: $command ..."
   $command || exit
@@ -648,11 +731,11 @@ if test $with_gettext = yes; then
   rm -f po/Makevars
   sed '
     /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
-    /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
+    /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
     /^XGETTEXT_OPTIONS *=/{
       s/$/ \\/
       a\
-         '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
+          '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
     }
   ' po/Makevars.template >po/Makevars

@@ -664,9 +747,9 @@ if test $with_gettext = yes; then
       /^subdir *=.*/s/=.*/= runtime-po/
       /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
       /^XGETTEXT_OPTIONS *=/{
-       s/$/ \\/
-       a\
-           '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
+        s/$/ \\/
+        a\
+            '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
       }
     ' <po/Makevars.template >runtime-po/Makevars

@@ -676,3 +759,7 @@ if test $with_gettext = yes; then
 fi

 echo "$0: done.  Now you can run './configure'."
+
+# Local Variables:
+# indent-tabs-mode: nil
+# End:
diff --git a/bootstrap.conf b/bootstrap.conf
index c7596c1..9f980ff 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -64,3 +64,6 @@ excluded_files='
 # In directories like lib/, m4/, and po/, generate both these files because we
 # still try to support CVS emulation.
 vc_ignore='.cvsignore .gitignore'
+
+# We don't provide README-hacking.
+checkout_only_file=HACKING
diff --git a/build-aux/.gitignore b/build-aux/.gitignore
index f4ac34d..335dbf6 100644
--- a/build-aux/.gitignore
+++ b/build-aux/.gitignore
@@ -14,3 +14,10 @@
 /missing
 /texinfo.tex
 /ylwrap
+announce-gen
+config.rpath
+gendocs.sh
+git-version-gen
+javacomp.sh.in
+javaexec.sh.in
+link-warning.h
diff --git a/doc/.gitignore b/doc/.gitignore
index 62a4e19..f8099a8 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -22,3 +22,4 @@
 /stamp-vti
 /version.texi
 /yacc.1
+gendocs_template
diff --git a/gnulib b/gnulib
index d162c75..fdccb1c 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit d162c752532b131d357bd1639147357e53cade0d
+Subproject commit fdccb1c31b8693bcda4faea73b0d81d1c3be0719
diff --git a/lib/.cvsignore b/lib/.cvsignore
index 8d2d4d2..c9bd742 100644
--- a/lib/.cvsignore
+++ b/lib/.cvsignore
@@ -4,6 +4,7 @@ Makefile.in
 argmatch.c
 argmatch.h
 basename.c
+bitrotate.h
 c-ctype.c
 c-ctype.h
 c-strcase.h
@@ -17,6 +18,7 @@ configmake.h
 dirname.c
 dirname.h
 dup-safer.c
+errno.h
 errno.in.h
 error.c
 error.h
@@ -30,6 +32,7 @@ getopt.in.h
 getopt1.c
 getopt_.h
 getopt_int.h
+getpagesize.c
 gettext.h
 gnulib.mk
 hash.c
@@ -46,6 +49,7 @@ mbsinit.c
 mbswidth.c
 mbswidth.h
 memchr.c
+memchr.valgrind
 obstack.c
 obstack.h
 pipe-safer.c
diff --git a/lib/.gitignore b/lib/.gitignore
index 73d272e..64648d0 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -7,6 +7,7 @@
 /argmatch.c
 /argmatch.h
 /basename.c
+/bitrotate.h
 /c-ctype.c
 /c-ctype.h
 /c-strcase.h
@@ -33,6 +34,7 @@
 /getopt1.c
 /getopt_.h
 /getopt_int.h
+/getpagesize.c
 /gettext.h
 /gnulib.mk
 /hash.c
@@ -49,6 +51,7 @@
 /mbswidth.c
 /mbswidth.h
 /memchr.c
+/memchr.valgrind
 /obstack.c
 /obstack.h
 /pipe-safer.c
@@ -109,3 +112,95 @@
 /xmalloc.c
 /xstrndup.c
 /xstrndup.h
+argmatch.c
+argmatch.h
+basename.c
+bitrotate.h
+c-ctype.c
+c-ctype.h
+c-strcase.h
+c-strcasecmp.c
+c-strncasecmp.c
+config.charset
+dirname.c
+dirname.h
+dup-safer.c
+errno.h
+errno.in.h
+error.c
+error.h
+exitfail.c
+exitfail.h
+fd-safer.c
+fopen-safer.c
+getopt.c
+getopt.h
+getopt.in.h
+getopt1.c
+getopt_int.h
+getpagesize.c
+gettext.h
+gnulib.mk
+hash.c
+hash.h
+intprops.h
+inttypes.h
+inttypes.in.h
+localcharset.c
+localcharset.h
+malloc.c
+mbrtowc.c
+mbsinit.c
+mbswidth.c
+mbswidth.h
+memchr.c
+memchr.valgrind
+obstack.c
+obstack.h
+pipe-safer.c
+quote.c
+quote.h
+quotearg.c
+quotearg.h
+ref-add.sed
+ref-add.sin
+ref-del.sed
+ref-del.sin
+stdbool.h
+stdbool.in.h
+stdint.h
+stdint.in.h
+stdio--.h
+stdio-safer.h
+stdlib.h
+stdlib.in.h
+stpcpy.c
+streq.h
+strerror.c
+string.h
+string.in.h
+stripslash.c
+strndup.c
+strnlen.c
+strtol.c
+strtoul.c
+strverscmp.c
+unistd--.h
+unistd-safer.h
+unistd.h
+unistd.in.h
+unitypes.h
+uniwidth.h
+unlocked-io.h
+unsetenv.c
+verify.h
+wchar.h
+wchar.in.h
+wctype.h
+wctype.in.h
+wcwidth.c
+xalloc-die.c
+xalloc.h
+xmalloc.c
+xstrndup.c
+xstrndup.h
diff --git a/m4/.cvsignore b/m4/.cvsignore
index 310e1ef..eb2f173 100644
--- a/m4/.cvsignore
+++ b/m4/.cvsignore
@@ -11,6 +11,7 @@ error.m4
 exitfail.m4
 extensions.m4
 getopt.m4
+getpagesize.m4
 gettext.m4
 gnulib-cache.m4
 gnulib-common.m4
@@ -40,6 +41,7 @@ mbsinit.m4
 mbstate_t.m4
 mbswidth.m4
 memchr.m4
+mmap-anon.m4
 multiarch.m4
 nls.m4
 po.m4
diff --git a/m4/.gitignore b/m4/.gitignore
index 0ca03ad..a953d72 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -11,6 +11,7 @@
 /exitfail.m4
 /extensions.m4
 /getopt.m4
+/getpagesize.m4
 /gettext.m4
 /gnulib-cache.m4
 /gnulib-common.m4
@@ -40,6 +41,7 @@
 /mbstate_t.m4
 /mbswidth.m4
 /memchr.m4
+/mmap-anon.m4
 /multiarch.m4
 /nls.m4
 /po.m4
@@ -73,3 +75,78 @@
 /wint_t.m4
 /xalloc.m4
 /xstrndup.m4
+00gnulib.m4
+argmatch.m4
+config-h.m4
+dirname.m4
+dos.m4
+double-slash-root.m4
+environ.m4
+errno_h.m4
+error.m4
+exitfail.m4
+extensions.m4
+getopt.m4
+getpagesize.m4
+gettext.m4
+gnulib-cache.m4
+gnulib-common.m4
+gnulib-comp.m4
+gnulib-tool.m4
+hash.m4
+iconv.m4
+include_next.m4
+inline.m4
+intlmacosx.m4
+inttypes-h.m4
+inttypes-pri.m4
+inttypes.m4
+javacomp.m4
+javaexec.m4
+lib-ld.m4
+lib-link.m4
+lib-prefix.m4
+localcharset.m4
+locale-fr.m4
+locale-ja.m4
+locale-zh.m4
+longlong.m4
+malloc.m4
+mbrtowc.m4
+mbsinit.m4
+mbstate_t.m4
+mbswidth.m4
+memchr.m4
+mmap-anon.m4
+multiarch.m4
+nls.m4
+po.m4
+progtest.m4
+quote.m4
+quotearg.m4
+setenv.m4
+stdbool.m4
+stdint.m4
+stdint_h.m4
+stdio-safer.m4
+stdlib_h.m4
+stpcpy.m4
+strerror.m4
+string_h.m4
+strndup.m4
+strnlen.m4
+strtol.m4
+strtoul.m4
+strverscmp.m4
+threadlib.m4
+unistd-safer.m4
+unistd_h.m4
+unlocked-io.m4
+warnings.m4
+wchar.m4
+wchar_t.m4
+wctype.m4
+wcwidth.m4
+wint_t.m4
+xalloc.m4
+xstrndup.m4
diff --git a/po/.gitignore b/po/.gitignore
index 79594c0..268fc70 100644
--- a/po/.gitignore
+++ b/po/.gitignore
@@ -20,3 +20,14 @@
 /remove-potcdate.sed
 /remove-potcdate.sin
 /stamp-po
+Makefile.in.in
+Makevars.template
+Rules-quot
+boldquot.sed
address@hidden
address@hidden
+insert-header.sed
+insert-header.sin
+quot.sed
+remove-potcdate.sed
+remove-potcdate.sin
-- 
1.6.3.3.334.g916e1


>From 7acbb1cdbe3977444e237ebf0aed50ea178ad4b6 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Sat, 18 Jul 2009 08:19:01 -0600
Subject: [PATCH 4/4] Use pipe module for more robust m4 subprocess.

* bootstrap.conf (gnulib_modules): Add pipe.
* configure.ac: Adjust to gnulib update.
* src/output.c (output_skeleton): Use gnulib functions.
* lib/local.mk (lib_libbison_a_SOURCES): Drop subpipe.
* .gitignore, lib/cvsignore, lib/.gitignore, m4/.cvsignore,
* m4/.gitignore: Regen.

Signed-off-by: Eric Blake <address@hidden>
---
 .gitignore     |    2 +-
 ChangeLog      |    8 ++++++
 bootstrap.conf |    2 +-
 configure.ac   |    3 +-
 lib/.cvsignore |   41 ++++++++++++++++++++++++++++++
 lib/.gitignore |   75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/local.mk   |    6 +---
 m4/.cvsignore  |   18 +++++++++++++
 m4/.gitignore  |   36 +++++++++++++++++++++++++++
 src/output.c   |   20 +++++++++-----
 10 files changed, 197 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore
index 6d46a77..efe18a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.dirstamp
 /*.cache
 /*.flc
 /*.prj
@@ -32,4 +33,3 @@
 /releases
 /stamp-h*
 ABOUT-NLS
-.dirstamp
diff --git a/ChangeLog b/ChangeLog
index 9b96bf2..9ad991e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-07-18  Eric Blake  <address@hidden>

+       Use pipe module for more robust m4 subprocess.
+       * bootstrap.conf (gnulib_modules): Add pipe.
+       * configure.ac: Adjust to gnulib update.
+       * src/output.c (output_skeleton): Use gnulib functions.
+       * lib/local.mk (lib_libbison_a_SOURCES): Drop subpipe.
+       * .gitignore, lib/cvsignore, lib/.gitignore, m4/.cvsignore,
+       * m4/.gitignore: Regen.
+
        Import latest bootstrap script.
        * gnulib: Update.
        * bootstrap: Copy from gnulib, plus a one-line change.
diff --git a/bootstrap.conf b/bootstrap.conf
index 9f980ff..d291bcd 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -20,7 +20,7 @@ gnulib_modules='
   announce-gen argmatch config-h c-strcase configmake dirname error
   extensions fopen-safer gendocs getopt gettext git-version-gen
   gnumakefile hash inttypes javacomp-script javaexec-script malloc
-  mbswidth obstack quote quotearg stdbool stpcpy strerror strtoul
+  mbswidth obstack pipe quote quotearg stdbool stpcpy strerror strtoul
   strverscmp unistd unistd-safer unlocked-io unsetenv verify warnings
   xalloc xalloc-die xstrndup
 '
diff --git a/configure.ac b/configure.ac
index eda5881..e27fa5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,7 +151,8 @@ gt_JAVAEXEC
 # So prefix paths with lib/.  See also etc/prefix-gnulib-mk.
 gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, , lib/,g'`
 for ac_var in ALLOCA_H ERRNO_H FCNTL_H GETOPT_H INTTYPES_H \
-              STDBOOL_H STDINT_H SYS_WAIT_H WCHAR_H WCTYPE_H
+              SCHED_H SPAWN_H STDBOOL_H STDINT_H SYS_WAIT_H \
+              WCHAR_H WCTYPE_H
 do
   eval "test 'x$ac_var' = x || $ac_var=lib/\$$ac_var"
 done
diff --git a/lib/.cvsignore b/lib/.cvsignore
index c9bd742..e5dfc4f 100644
--- a/lib/.cvsignore
+++ b/lib/.cvsignore
@@ -1,6 +1,8 @@
 .deps
 Makefile
 Makefile.in
+alloca.h
+alloca.in.h
 argmatch.c
 argmatch.h
 basename.c
@@ -24,8 +26,13 @@ error.c
 error.h
 exitfail.c
 exitfail.h
+fatal-signal.c
+fatal-signal.h
+fcntl.h
+fcntl.in.h
 fd-safer.c
 fopen-safer.c
+getdtablesize.c
 getopt.c
 getopt.h
 getopt.in.h
@@ -52,15 +59,41 @@ memchr.c
 memchr.valgrind
 obstack.c
 obstack.h
+open.c
 pipe-safer.c
+pipe.c
+pipe.h
 quote.c
 quote.h
 quotearg.c
 quotearg.h
+rawmemchr.c
+rawmemchr.valgrind
 ref-add.sed
 ref-add.sin
 ref-del.sed
 ref-del.sin
+sched.h
+sched.in.h
+sig-handler.h
+sigaction.c
+signal.h
+signal.in.h
+sigprocmask.c
+spawn.h
+spawn.in.h
+spawn_faction_addclose.c
+spawn_faction_adddup2.c
+spawn_faction_addopen.c
+spawn_faction_destroy.c
+spawn_faction_init.c
+spawn_int.h
+spawnattr_destroy.c
+spawnattr_init.c
+spawnattr_setflags.c
+spawnattr_setsigmask.c
+spawni.c
+spawnp.c
 stamp-h1
 stdbool.h
 stdbool.in.h
@@ -74,6 +107,8 @@ stdlib.h
 stdlib.in.h
 stdlib_.h
 stpcpy.c
+strchrnul.c
+strchrnul.valgrind
 streq.h
 strerror.c
 string.h
@@ -86,6 +121,9 @@ strtol.c
 strtoul.c
 strverscmp.c
 strverscmp.h
+sys
+sys_wait.h
+sys_wait.in.h
 unistd--.h
 unistd-safer.h
 unistd.h
@@ -97,6 +135,9 @@ uniwidth.h
 unlocked-io.h
 unsetenv.c
 verify.h
+w32spawn.h
+wait-process.c
+wait-process.h
 wchar.h
 wchar.in.h
 wchar_.h
diff --git a/lib/.gitignore b/lib/.gitignore
index 64648d0..9cbf1ed 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -4,6 +4,7 @@
 /.deps
 /Makefile
 /Makefile.in
+/alloca.in.h
 /argmatch.c
 /argmatch.h
 /basename.c
@@ -26,8 +27,12 @@
 /error.h
 /exitfail.c
 /exitfail.h
+/fatal-signal.c
+/fatal-signal.h
+/fcntl.in.h
 /fd-safer.c
 /fopen-safer.c
+/getdtablesize.c
 /getopt.c
 /getopt.h
 /getopt.in.h
@@ -54,15 +59,38 @@
 /memchr.valgrind
 /obstack.c
 /obstack.h
+/open.c
 /pipe-safer.c
+/pipe.c
+/pipe.h
 /quote.c
 /quote.h
 /quotearg.c
 /quotearg.h
+/rawmemchr.c
+/rawmemchr.valgrind
 /ref-add.sed
 /ref-add.sin
 /ref-del.sed
 /ref-del.sin
+/sched.in.h
+/sig-handler.h
+/sigaction.c
+/signal.in.h
+/sigprocmask.c
+/spawn.in.h
+/spawn_faction_addclose.c
+/spawn_faction_adddup2.c
+/spawn_faction_addopen.c
+/spawn_faction_destroy.c
+/spawn_faction_init.c
+/spawn_int.h
+/spawnattr_destroy.c
+/spawnattr_init.c
+/spawnattr_setflags.c
+/spawnattr_setsigmask.c
+/spawni.c
+/spawnp.c
 /stamp-h1
 /stdbool.h
 /stdbool.in.h
@@ -76,6 +104,8 @@
 /stdlib.in.h
 /stdlib_.h
 /stpcpy.c
+/strchrnul.c
+/strchrnul.valgrind
 /streq.h
 /strerror.c
 /string.h
@@ -88,6 +118,7 @@
 /strtoul.c
 /strverscmp.c
 /strverscmp.h
+/sys_wait.in.h
 /unistd--.h
 /unistd-safer.h
 /unistd.h
@@ -99,6 +130,9 @@
 /unlocked-io.h
 /unsetenv.c
 /verify.h
+/w32spawn.h
+/wait-process.c
+/wait-process.h
 /wchar.h
 /wchar.in.h
 /wchar_.h
@@ -112,6 +146,8 @@
 /xmalloc.c
 /xstrndup.c
 /xstrndup.h
+alloca.h
+alloca.in.h
 argmatch.c
 argmatch.h
 basename.c
@@ -131,8 +167,13 @@ error.c
 error.h
 exitfail.c
 exitfail.h
+fatal-signal.c
+fatal-signal.h
+fcntl.h
+fcntl.in.h
 fd-safer.c
 fopen-safer.c
+getdtablesize.c
 getopt.c
 getopt.h
 getopt.in.h
@@ -157,15 +198,41 @@ memchr.c
 memchr.valgrind
 obstack.c
 obstack.h
+open.c
 pipe-safer.c
+pipe.c
+pipe.h
 quote.c
 quote.h
 quotearg.c
 quotearg.h
+rawmemchr.c
+rawmemchr.valgrind
 ref-add.sed
 ref-add.sin
 ref-del.sed
 ref-del.sin
+sched.h
+sched.in.h
+sig-handler.h
+sigaction.c
+signal.h
+signal.in.h
+sigprocmask.c
+spawn.h
+spawn.in.h
+spawn_faction_addclose.c
+spawn_faction_adddup2.c
+spawn_faction_addopen.c
+spawn_faction_destroy.c
+spawn_faction_init.c
+spawn_int.h
+spawnattr_destroy.c
+spawnattr_init.c
+spawnattr_setflags.c
+spawnattr_setsigmask.c
+spawni.c
+spawnp.c
 stdbool.h
 stdbool.in.h
 stdint.h
@@ -175,6 +242,8 @@ stdio-safer.h
 stdlib.h
 stdlib.in.h
 stpcpy.c
+strchrnul.c
+strchrnul.valgrind
 streq.h
 strerror.c
 string.h
@@ -185,6 +254,9 @@ strnlen.c
 strtol.c
 strtoul.c
 strverscmp.c
+sys
+sys_wait.h
+sys_wait.in.h
 unistd--.h
 unistd-safer.h
 unistd.h
@@ -194,6 +266,9 @@ uniwidth.h
 unlocked-io.h
 unsetenv.c
 verify.h
+w32spawn.h
+wait-process.c
+wait-process.h
 wchar.h
 wchar.in.h
 wctype.h
diff --git a/lib/local.mk b/lib/local.mk
index 7b12dcc..7b80e09 100644
--- a/lib/local.mk
+++ b/lib/local.mk
@@ -1,6 +1,6 @@
 # Make bison/lib.

-# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008 Free Software
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008, 2009 Free Software
 # Foundation, Inc.

 # This program is free software: you can redistribute it and/or modify
@@ -51,9 +51,7 @@ lib_libbison_a_SOURCES +=                       \
 # Non-gnulib sources in Bison's internal library.
 lib_libbison_a_SOURCES +=                       \
   lib/get-errno.h                               \
-  lib/get-errno.c                               \
-  lib/subpipe.h                                 \
-  lib/subpipe.c
+  lib/get-errno.c

 # The Yacc compatibility library.
 lib_LIBRARIES = $(YACC_LIBRARY)
diff --git a/m4/.cvsignore b/m4/.cvsignore
index eb2f173..87164ad 100644
--- a/m4/.cvsignore
+++ b/m4/.cvsignore
@@ -1,5 +1,6 @@
 00gnulib.m4
 absolute-header.m4
+alloca.m4
 argmatch.m4
 config-h.m4
 dirname.m4
@@ -10,6 +11,9 @@ errno_h.m4
 error.m4
 exitfail.m4
 extensions.m4
+fatal-signal.m4
+fcntl_h.m4
+getdtablesize.m4
 getopt.m4
 getpagesize.m4
 gettext.m4
@@ -42,19 +46,31 @@ mbstate_t.m4
 mbswidth.m4
 memchr.m4
 mmap-anon.m4
+mode_t.m4
 multiarch.m4
 nls.m4
+open.m4
+pipe.m4
 po.m4
+posix_spawn.m4
 progtest.m4
 quote.m4
 quotearg.m4
+rawmemchr.m4
+sched_h.m4
 setenv.m4
+sig_atomic_t.m4
+sigaction.m4
+signal_h.m4
+signalblocking.m4
+spawn_h.m4
 stdbool.m4
 stdint.m4
 stdint_h.m4
 stdio-safer.m4
 stdlib_h.m4
 stpcpy.m4
+strchrnul.m4
 strerror.m4
 string_h.m4
 strndup.m4
@@ -62,10 +78,12 @@ strnlen.m4
 strtol.m4
 strtoul.m4
 strverscmp.m4
+sys_wait_h.m4
 threadlib.m4
 unistd-safer.m4
 unistd_h.m4
 unlocked-io.m4
+wait-process.m4
 warning.m4
 warnings.m4
 wchar.m4
diff --git a/m4/.gitignore b/m4/.gitignore
index a953d72..7c1277c 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -1,5 +1,6 @@
 /00gnulib.m4
 /absolute-header.m4
+/alloca.m4
 /argmatch.m4
 /config-h.m4
 /dirname.m4
@@ -10,6 +11,9 @@
 /error.m4
 /exitfail.m4
 /extensions.m4
+/fatal-signal.m4
+/fcntl_h.m4
+/getdtablesize.m4
 /getopt.m4
 /getpagesize.m4
 /gettext.m4
@@ -42,19 +46,31 @@
 /mbswidth.m4
 /memchr.m4
 /mmap-anon.m4
+/mode_t.m4
 /multiarch.m4
 /nls.m4
+/open.m4
+/pipe.m4
 /po.m4
+/posix_spawn.m4
 /progtest.m4
 /quote.m4
 /quotearg.m4
+/rawmemchr.m4
+/sched_h.m4
 /setenv.m4
+/sig_atomic_t.m4
+/sigaction.m4
+/signal_h.m4
+/signalblocking.m4
+/spawn_h.m4
 /stdbool.m4
 /stdint.m4
 /stdint_h.m4
 /stdio-safer.m4
 /stdlib_h.m4
 /stpcpy.m4
+/strchrnul.m4
 /strerror.m4
 /string_h.m4
 /strndup.m4
@@ -62,10 +78,12 @@
 /strtol.m4
 /strtoul.m4
 /strverscmp.m4
+/sys_wait_h.m4
 /threadlib.m4
 /unistd-safer.m4
 /unistd_h.m4
 /unlocked-io.m4
+/wait-process.m4
 /warning.m4
 /warnings.m4
 /wchar.m4
@@ -76,6 +94,7 @@
 /xalloc.m4
 /xstrndup.m4
 00gnulib.m4
+alloca.m4
 argmatch.m4
 config-h.m4
 dirname.m4
@@ -86,6 +105,9 @@ errno_h.m4
 error.m4
 exitfail.m4
 extensions.m4
+fatal-signal.m4
+fcntl_h.m4
+getdtablesize.m4
 getopt.m4
 getpagesize.m4
 gettext.m4
@@ -118,19 +140,31 @@ mbstate_t.m4
 mbswidth.m4
 memchr.m4
 mmap-anon.m4
+mode_t.m4
 multiarch.m4
 nls.m4
+open.m4
+pipe.m4
 po.m4
+posix_spawn.m4
 progtest.m4
 quote.m4
 quotearg.m4
+rawmemchr.m4
+sched_h.m4
 setenv.m4
+sig_atomic_t.m4
+sigaction.m4
+signal_h.m4
+signalblocking.m4
+spawn_h.m4
 stdbool.m4
 stdint.m4
 stdint_h.m4
 stdio-safer.m4
 stdlib_h.m4
 stpcpy.m4
+strchrnul.m4
 strerror.m4
 string_h.m4
 strndup.m4
@@ -138,10 +172,12 @@ strnlen.m4
 strtol.m4
 strtoul.m4
 strverscmp.m4
+sys_wait_h.m4
 threadlib.m4
 unistd-safer.m4
 unistd_h.m4
 unlocked-io.m4
+wait-process.m4
 warnings.m4
 wchar.m4
 wchar_t.m4
diff --git a/src/output.c b/src/output.c
index 5f2d150..ffa7786 100644
--- a/src/output.c
+++ b/src/output.c
@@ -21,12 +21,14 @@
 #include <config.h>
 #include "system.h"

+#include <assert.h>
 #include <configmake.h>
 #include <error.h>
 #include <get-errno.h>
+#include <pipe.h>
 #include <quotearg.h>
-#include <subpipe.h>
 #include <timevar.h>
+#include <wait-process.h>

 #include "complain.h"
 #include "files.h"
@@ -635,10 +637,12 @@ output_skeleton (void)
     argv[i++] = full_m4bison;
     argv[i++] = full_skeleton;
     argv[i++] = NULL;
+    assert(i <= sizeof argv / sizeof *argv);
   }

-  init_subpipe ();
-  pid = create_subpipe (argv, filter_fd);
+  pid = create_pipe_bidi (argv[0], argv[0], (char **) argv,
+                          false, true, true,
+                          filter_fd);
   free (full_m4sugar);
   free (full_m4bison);
   free (full_skeleton);
@@ -646,7 +650,7 @@ output_skeleton (void)
   if (trace_flag & trace_muscles)
     muscles_output (stderr);
   {
-    FILE *out = fdopen (filter_fd[0], "w");
+    FILE *out = fdopen (filter_fd[1], "w");
     if (! out)
       error (EXIT_FAILURE, get_errno (),
              "fdopen");
@@ -656,14 +660,16 @@ output_skeleton (void)

   /* Read and process m4's output.  */
   timevar_push (TV_M4);
-  end_of_output_subpipe (pid, filter_fd);
-  in = fdopen (filter_fd[1], "r");
+  in = fdopen (filter_fd[0], "r");
   if (! in)
     error (EXIT_FAILURE, get_errno (),
           "fdopen");
   scan_skel (in);
   xfclose (in);
-  reap_subpipe (pid, m4);
+  wait_subprocess (pid, m4,
+                   true, false,
+                   false, true,
+                   0);
   timevar_pop (TV_M4);
 }

-- 
1.6.3.3.334.g916e1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]