bug-idutils
[Top][All Lists]
Advanced

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

[bug-idutils] preparing for release


From: Jim Meyering
Subject: [bug-idutils] preparing for release
Date: Wed, 16 Jun 2010 11:56:27 +0200

I had a few accumulated patches
and have just pushed them (included below).

If anyone else has pending problems or patches, please let me know soon.
I expect to make a stable release in the next few days.

>From eb170e813979f81b9103f51d3616de29389e4513 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 20 Jan 2010 21:31:40 +0100
Subject: [PATCH 01/12] mkid: use ftello (not ftell) and fail if an offset is 
2^32 or larger

This is necessary because the internal layout requires that an
offset be representable as a 4-byte quantity.
* src/mkid.c (write_id_file): Use ftello, not ftell.
The latter would fail on files larger than 4GiB.  Now,
we still fail for such files, but use ftello instead --
and give a diagnostic.
---
 gnulib     |    2 +-
 src/mkid.c |   15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/gnulib b/gnulib
index 0c6cf5a..880f2b6 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 0c6cf5ab43555377b99d94febb2d6f23fc3d2cb0
+Subproject commit 880f2b69df57af506439d6aaf1fe185a6f960e43
diff --git a/src/mkid.c b/src/mkid.c
index 59ac41a..b1a0fa9 100644
--- a/src/mkid.c
+++ b/src/mkid.c
@@ -710,14 +710,20 @@ write_id_file (struct idhead *idhp)
   /* write out the list of pathnames */

   fseek (idhp->idh_FILE, sizeof_idhead (), 0);
-  idhp->idh_flinks_offset = ftell (idhp->idh_FILE);
+  off_t off = ftello (idhp->idh_FILE);
+  if (UINT32_MAX < off)
+    error (EXIT_FAILURE, 0, _("internal limitation: offset of 2^32 or 
larger"));
+  idhp->idh_flinks_offset = off;
   serialize_file_links (idhp);

   /* write out the list of identifiers */

   putc ('\0', idhp->idh_FILE);
   putc ('\0', idhp->idh_FILE);
-  idhp->idh_tokens_offset = ftell (idhp->idh_FILE);
+  off = ftello (idhp->idh_FILE);
+  if (UINT32_MAX < off)
+    error (EXIT_FAILURE, 0, _("internal limitation: offset of 2^32 or 
larger"));
+  idhp->idh_tokens_offset = off;

   for (i = 0; i < token_table.ht_fill; i++, tokens++)
     {
@@ -761,7 +767,10 @@ write_id_file (struct idhead *idhp)
     }
   assert_hits (summary_root);
   idhp->idh_tokens = token_table.ht_fill;
-  output_length = ftell (idhp->idh_FILE);
+  off = ftello (idhp->idh_FILE);
+  if (UINT32_MAX < off)
+    error (EXIT_FAILURE, 0, _("internal limitation: offset of 2^32 or 
larger"));
+  output_length = off;
   idhp->idh_end_offset = output_length - 2;
   idhp->idh_buf_size = max_buf_size;
   idhp->idh_vec_size = max_vec_size;
--
1.7.1.556.ga4230


>From 4900e6847bf8ef3be13efb48ed1008addf9dfa32 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 30 Mar 2010 13:36:26 +0200
Subject: [PATCH 02/12] doc: add @dircategory to Info documentation

The Texinfo documentation says that Info files should use @dircategory,
and suggests consulting the Free Software Directory to select a category
name.  The directory places under ""Text creation and manipulation".
* doc/idutils.texi: Add "@dircategory Text creation and manipulation".
Inspired by a nearly identical patch by Colin Watson for Parted.
---
 doc/idutils.texi |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/doc/idutils.texi b/doc/idutils.texi
index a047adf..2b68233 100644
--- a/doc/idutils.texi
+++ b/doc/idutils.texi
@@ -18,13 +18,15 @@
 @syncodeindex pg cp
 @syncodeindex vr cp

address@hidden Text creation and manipulation
 @ifinfo
 @format
 START-INFO-DIR-ENTRY
-* ID database: (idutils).              Identifier database utilities.
+* ID utilities: (idutils).             Indexing and searching utilities.
 * mkid: (idutils)mkid invocation.      Creating an ID database.
 * lid: (idutils)lid invocation.        Matching words and patterns.
 * fid: (idutils)fid invocation.        Listing a file's tokens.
+* gid: (idutils)gid invocation.        Token-based grep.
 * fnid: (idutils)fnid invocation.      Looking up file names.
 * xtokid: (idutils)xtokid invocation.  Testing mkid scanners.
 END-INFO-DIR-ENTRY
@@ -78,6 +80,7 @@ This manual documents version @value{VERSION} of the ID 
utilities.
 * mkid invocation::             Creating an ID database.
 * lid invocation::              Querying an ID database by token.
 * fid invocation::              Listing a file's tokens.
+* gid invocation::              Token-based grep
 * fnid invocation::             Looking up file names.
 * xtokid invocation::           Testing language scanners.
 * Past and Future::             History and future directions.
--
1.7.1.556.ga4230


>From d958af18d07bd4c01685f101a75c691c35a30089 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 30 Mar 2010 13:43:44 +0200
Subject: [PATCH 03/12] doc: add "gid" to the menus and direntry list

* doc/idutils.texi (gid invocation): Add a section on "gid".
---
 doc/idutils.texi |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/doc/idutils.texi b/doc/idutils.texi
index 2b68233..29fd44b 100644
--- a/doc/idutils.texi
+++ b/doc/idutils.texi
@@ -1259,6 +1259,25 @@ fnid \*.c
 here protects the @samp{*} from being expanded by the shell.)

 @c ************* gkm *********************************************************
address@hidden gid invocation
address@hidden @code{gid}: Token-based grep
+
address@hidden gid
address@hidden searching files, grep
+
address@hidden lists each line containing one of the specified tokens.
+
+Running @command{gid} is equivalent to @samp{lid -R grep})
+
+For example, the command:
+
address@hidden
+gid important_variable
address@hidden example
+
address@hidden lists each line of each file in the database that contains that 
token.
+
address@hidden ************* gkm 
*********************************************************
 @node xtokid invocation
 @chapter @file{xtokid}: Testing Language Scanners

--
1.7.1.556.ga4230


>From 080106b3d8ae87d8851c489b32175b98e4978c4e Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 9 May 2010 20:35:48 +0200
Subject: [PATCH 04/12] build: update from gnulib

* bootstrap: Update from gnulib.
* testsuite/init.sh: Update from gnulib.
* gnulib: Update to latest.
---
 bootstrap         |   97 +++++++++++++++++++++++++++++++++++++---------------
 testsuite/init.sh |    9 ++++-
 2 files changed, 76 insertions(+), 30 deletions(-)

diff --git a/bootstrap b/bootstrap
index 456b0b2..a9a778a 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,4 +1,6 @@
 #! /bin/sh
+# Print a version string.
+scriptversion=2010-04-30.16; # UTC

 # Bootstrap this package from checked-out sources.

@@ -17,7 +19,15 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.

-# Written by Paul Eggert.
+# Originally written by Paul Eggert.  The canonical version of this
+# script is maintained as build-aux/bootstrap in gnulib, however, to
+# be useful to your project, you should place a copy of it under
+# version control in the top-level directory of your project.  The
+# intent is that all customization can be done with a bootstrap.conf
+# file also maintained in your version control; gnulib comes with a
+# template build-aux/bootstrap.conf to get you started.
+
+# Please report bugs or propose patches to address@hidden

 nl='
 '
@@ -43,7 +53,7 @@ Options:
                           sources reside.  Use this if you already
                           have gnulib sources on your machine, and
                           do not want to waste your bandwidth downloading
-                          them again.
+                          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.
@@ -71,6 +81,7 @@ gnulib_modules=
 gnulib_files=

 # A function to be called after everything else in this script.
+# Override it via your own definition in bootstrap.conf.
 bootstrap_epilogue() { :; }

 # The command to download all .po files for a specified domain into
@@ -132,7 +143,8 @@ XGETTEXT_OPTIONS='\\\
  --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
 '

-# Package bug report address for gettext files
+# Package bug report address and copyright holder for gettext files
+COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
 address@hidden

 # Files we don't want to import.
@@ -159,7 +171,6 @@ vc_ignore=auto
 # die otherwise.
 find_tool ()
 {
-  # Find sha1sum, named gsha1sum on MacPorts.
   find_tool_envvar=$1
   shift
   find_tool_names=$@
@@ -187,8 +198,8 @@ find_tool ()
   eval "export $find_tool_envvar"
 }

-# Find sha1sum, named gsha1sum on MacPorts.
-find_tool SHA1SUM sha1sum gsha1sum
+# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
+find_tool SHA1SUM sha1sum gsha1sum shasum

 # Override the default configuration, if necessary.
 # Make sure that bootstrap.conf is sourced from the current directory
@@ -313,10 +324,20 @@ get_version() {
   $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
+  sed -n '# extract version within line
+          s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
+          t done
+
+          # extract version at start of line
+          s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
           t done
+
           d
+
           :done
+          #the following essentially does s/5.005/5.5/
+          s/\.0*\([1-9]\)/.\1/g
+          p
           q'
 }

@@ -379,7 +400,7 @@ fi

 cleanup_gnulib() {
   status=$?
-  rm -fr gnulib
+  rm -fr "$gnulib_path"
   exit $status
 }

@@ -387,6 +408,8 @@ git_modules_config () {
   test -f .gitmodules && git config --file .gitmodules "$@"
 }

+gnulib_path=`git_modules_config submodule.gnulib.path`
+
 # Get gnulib files.

 case ${GNULIB_SRCDIR--} in
@@ -396,30 +419,43 @@ case ${GNULIB_SRCDIR--} in
     git submodule init || exit $?
     git submodule update || exit $?

-  elif [ ! -d gnulib ]; then
+  elif [ ! -d "$gnulib_path" ]; then
     echo "$0: getting gnulib files..."

     trap cleanup_gnulib 1 2 13 15

-    git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
-    git clone $shallow git://git.sv.gnu.org/gnulib ||
+    git clone -h|grep -- --depth > /dev/null && shallow='--depth 2' || shallow=
+    git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
       cleanup_gnulib

     trap - 1 2 13 15
   fi
-  GNULIB_SRCDIR=gnulib
+  GNULIB_SRCDIR=$gnulib_path
   ;;
 *)
-  # Redirect the gnulib submodule to the directory on the command line
-  # if possible.
+  # Use GNULIB_SRCDIR as a reference.
   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
+    if git submodule -h|grep -- --reference > /dev/null; then
+      # Prefer the one-liner available in git 1.6.4 or newer.
+      git submodule update --init --reference "$GNULIB_SRCDIR" \
+        "$gnulib_path" || exit $?
+    else
+      # 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 $?
+      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 \
+          || exit $?
+      fi
+    fi
+    GNULIB_SRCDIR=$gnulib_path
   fi
   ;;
 esac
@@ -452,7 +488,7 @@ update_po_files() {
   test -d $ref_po_dir || mkdir $ref_po_dir || return
   download_po_files $ref_po_dir $domain \
     && ls "$ref_po_dir"/*.po 2>/dev/null |
-      sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"
+      sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return

   langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
   test "$langs" = '*' && langs=x
@@ -625,7 +661,7 @@ slurp() {
       for excluded_file in $excluded_files; do
         test "$dir/$file" = "$excluded_file" && continue 2
       done
-      if test $file = Makefile.am; then
+      if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then
         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 
|| {
@@ -643,7 +679,7 @@ slurp() {
           rm -f $dir/$file
           sed '
             /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
-              AC_DEFUN([AM_INTL_SUBDIR], [
+              AC_DEFUN([AM_INTL_SUBDIR], [])
             /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
               AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
             $a\
@@ -732,7 +768,7 @@ find "$m4_base" "$source_base" \
 # Reconfigure, getting other files.

 # Skip autoheader if it's not needed.
-grep '^[        ]*AC_CONFIG_HEADERS\>' configure.ac >/dev/null ||
+grep -E '^[     ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null ||
   AUTOHEADER=true

 for command in \
@@ -776,13 +812,14 @@ if test $with_gettext = yes; then
   rm -f po/Makevars
   sed '
     /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
-    /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
+    /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
+    /^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
     /^XGETTEXT_OPTIONS *=/{
       s/$/ \\/
       a\
           '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
     }
-  ' po/Makevars.template >po/Makevars
+  ' po/Makevars.template >po/Makevars || exit 1

   if test -d runtime-po; then
     # Similarly for runtime-po/Makevars, but not quite the same.
@@ -796,7 +833,7 @@ if test $with_gettext = yes; then
         a\
             '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
       }
-    ' <po/Makevars.template >runtime-po/Makevars
+    ' po/Makevars.template >runtime-po/Makevars || exit 1

     # Copy identical files from po to runtime-po.
     (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
@@ -807,6 +844,10 @@ bootstrap_epilogue

 echo "$0: done.  Now you can run './configure'."

-# Local Variables:
-# indent-tabs-mode: nil
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/testsuite/init.sh b/testsuite/init.sh
index 512e876..7772736 100644
--- a/testsuite/init.sh
+++ b/testsuite/init.sh
@@ -21,11 +21,16 @@
 # The typical skeleton of a test looks like this:
 #
 #   #!/bin/sh
-#   : ${srcdir=.}
-#   . "$srcdir/init.sh"; path_prepend_ .
+#   . "${srcdir=.}/init.sh"; path_prepend_ .
 #   Execute some commands.
 #   Note that these commands are executed in a subdirectory, therefore you
 #   need to prepend "../" to relative filenames in the build directory.
+#   Note that the "path_prepend_ ." is useful only if the body of your
+#   test invokes programs residing in the initial directory.
+#   For example, if the programs you want to test are in src/, and this test
+#   script is named tests/test-1, then you would use "path_prepend_ ../src",
+#   or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH"
+#   to all tests via automake's TESTS_ENVIRONMENT.
 #   Set the exit code 0 for success, 77 for skipped, or 1 or other for failure.
 #   Use the skip_ and fail_ functions to print a diagnostic and then exit
 #   with the corresponding exit code.
--
1.7.1.556.ga4230


>From 38866e47fd4ec4c1ce5da9a2f0e8a1e963c36357 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 9 May 2010 20:49:15 +0200
Subject: [PATCH 05/12] build: avoid new syntax-check failure

* libidu/iduglobal.h (FNM_FILE_NAME): Remove definition.
Now, it's provided by gnulib.
---
 libidu/iduglobal.h |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/libidu/iduglobal.h b/libidu/iduglobal.h
index 95d1fb2..703bb23 100644
--- a/libidu/iduglobal.h
+++ b/libidu/iduglobal.h
@@ -44,10 +44,6 @@

 #define DEBUG(args) /* printf args */

-#ifndef FNM_FILE_NAME
-#define FNM_FILE_NAME FNM_PATHNAME
-#endif
-
 #if HAVE_LINK
 #define MAYBE_FNM_CASEFOLD 0
 #else
--
1.7.1.556.ga4230


>From 8312ad98344434da5069d1ca5d33133b0fec7939 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 9 May 2010 21:22:56 +0200
Subject: [PATCH 06/12] tests: adjust help-version

* testsuite/help-version: Use one-line invocation of init.sh.
---
 testsuite/help-version |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/testsuite/help-version b/testsuite/help-version
index 5e51aa9..10f93ad 100755
--- a/testsuite/help-version
+++ b/testsuite/help-version
@@ -23,8 +23,7 @@
 test "x$SHELL" = x && SHELL=/bin/sh
 export SHELL

-: ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ ../src
+. "${srcdir=.}/init.sh"; path_prepend_ ../src

 expected_failure_status_chroot=125
 expected_failure_status_env=125
--
1.7.1.556.ga4230


>From 179f395e2c54306693c4ea8704df6c7eb2f6436f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 15 Jun 2010 23:52:37 +0200
Subject: [PATCH 07/12] build: require gettext-0.18

* configure.ac: Require it here...
* bootstrap.conf (buildreq): ...and here.
---
 bootstrap.conf |    2 +-
 configure.ac   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index 860d914..8b34093 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -140,7 +140,7 @@ autoconf   2.61
 automake   1.11
 autopoint  -
 bison      -
-gettext    -
+gettext    0.18
 git        1.4.4
 gperf      -
 gzip       -
diff --git a/configure.ac b/configure.ac
index 861ea82..31b49d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,7 +103,7 @@ AC_TYPE_SIZE_T
 AC_CHECK_TYPES(ptrdiff_t)

 AM_GNU_GETTEXT([external], [need-ngettext])
-AM_GNU_GETTEXT_VERSION([0.17])
+AM_GNU_GETTEXT_VERSION([0.18])

 AC_CONFIG_FILES([
                  po/Makefile.in
--
1.7.1.556.ga4230


>From 7d8ab3a39de9ad3115eeed1b88de811ddc0f9c05 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 15 Jun 2010 23:48:08 +0200
Subject: [PATCH 08/12] build: update gnulib submodule to latest

---
 gnulib |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gnulib b/gnulib
index 880f2b6..b96ebff 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 880f2b69df57af506439d6aaf1fe185a6f960e43
+Subproject commit b96ebffa5a9a0ba39c89c1b519142a2c5d324a11
--
1.7.1.556.ga4230


>From 10d50d8e86e69ba2b183a404ea0782922970fbe5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 16 Jun 2010 07:46:39 +0200
Subject: [PATCH 09/12] maint: update bootstrap and init.sh from gnulib

* bootstrap: Update from gnulib.
* testsuite/init.sh: Likewise.
---
 bootstrap         |    6 ++-
 testsuite/init.sh |   97 +++++++++++++++++++++++++++++++++-------------------
 2 files changed, 65 insertions(+), 38 deletions(-)

diff --git a/bootstrap b/bootstrap
index a9a778a..2422549 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2010-04-30.16; # UTC
+scriptversion=2010-05-17.18; # UTC

 # Bootstrap this package from checked-out sources.

@@ -409,6 +409,7 @@ git_modules_config () {
 }

 gnulib_path=`git_modules_config submodule.gnulib.path`
+: ${gnulib_path=gnulib}

 # Get gnulib files.

@@ -424,7 +425,8 @@ case ${GNULIB_SRCDIR--} in

     trap cleanup_gnulib 1 2 13 15

-    git clone -h|grep -- --depth > /dev/null && shallow='--depth 2' || shallow=
+    shallow=
+    git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
     git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
       cleanup_gnulib

diff --git a/testsuite/init.sh b/testsuite/init.sh
index 7772736..7943526 100644
--- a/testsuite/init.sh
+++ b/testsuite/init.sh
@@ -57,71 +57,97 @@
 #   4. Finally
 #   $ exit

+ME_=`expr "./$0" : '.*/\(.*\)$'`
+
+# We use a trap below for cleanup.  This requires us to go through
+# hoops to get the right exit status transported through the handler.
+# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
+# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
+# sh inside this function.
+Exit () { set +e; (exit $1); exit $1; }
+
+# Print warnings (e.g., about skipped and failed tests) to this file number.
+# Override by defining to say, 9, in init.cfg, and putting say,
+# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition
+# of TESTS_ENVIRONMENT in your tests/Makefile.am file.
+# This is useful when using automake's parallel tests mode, to print
+# the reason for skip/failure to console, rather than to the .log files.
+: ${stderr_fileno_=2}
+
+warn_() { echo "$@" 1>&$stderr_fileno_; }
+fail_() { warn_ "$ME_: failed test: $@"; Exit 1; }
+skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; }
+framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 99; }
+
 # We require $(...) support unconditionally.
 # We require a few additional shell features only when $EXEEXT is nonempty,
 # in order to support automatic $EXEEXT emulation:
 # - hyphen-containing alias names
 # - we prefer to use ${var#...} substitution, rather than having
 #   to work around lack of support for that feature.
-# The following code attempts to find a shell with support for these features
-# and re-exec's it.  If not, it skips the current test.
+# The following code attempts to find a shell with support for these features.
+# If the current shell passes the test, we're done.  Otherwise, test other
+# shells until we find one that passes.  If one is found, re-exec it.
+# If no acceptable shell is found, skip the current test.
+#
+# Use "9" to indicate success (rather than 0), in case some shell acts
+# like Solaris 10's /bin/sh but exits successfully instead of with status 2.

 gl_shell_test_script_='
 test $(echo y) = y || exit 1
-test -z "$EXEEXT" && exit 0
+test -z "$EXEEXT" && exit 9
 shopt -s expand_aliases
 alias a-b="echo zoo"
 v=abx
      test ${v%x} = ab \
   && test ${v#a} = bx \
-  && test $(a-b) = zoo
+  && test $(a-b) = zoo \
+  && exit 9
 '

 if test "x$1" = "x--no-reexec"; then
   shift
 else
-  for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail
-  do
-    test "$re_shell_" = no_shell && continue
-    test "$re_shell_" = fail && skip_ failed to find an adequate shell
-    if "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null; then
-      exec "$re_shell_" "$0" --no-reexec "$@"
-      echo "$ME_: exec failed" 1>&2
-      exit 127
-    fi
-  done
+  # 'eval'ing the above code makes Solaris 10's /bin/sh exit with $? set to 2.
+  # It does not evaluate any of the code after the "unexpected" `('.  Thus,
+  # we must run it in a subshell.
+  ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
+  if test $? = 9; then
+    : # The current shell is adequate.  No re-exec required.
+  else
+    # Search for a shell that meets our requirements.
+    for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh 
fail
+    do
+      test "$re_shell_" = no_shell && continue
+      test "$re_shell_" = fail && skip_ failed to find an adequate shell
+      "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
+      if test $? = 9; then
+        # Found an acceptable shell.
+        exec "$re_shell_" "$0" --no-reexec "$@"
+        echo "$ME_: exec failed" 1>&2
+        exit 127
+      fi
+    done
+  fi
 fi

 test -n "$EXEEXT" && shopt -s expand_aliases

-# We use a trap below for cleanup.  This requires us to go through
-# hoops to get the right exit status transported through the handler.
-# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
-# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
-# sh inside this function.
-Exit () { set +e; (exit $1); exit $1; }
-
-# Print warnings (e.g., about skipped and failed tests) to this file number.
-# Override by defining to say, 9, in init.cfg, and putting say,
-# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition
-# of TESTS_ENVIRONMENT in your tests/Makefile.am file.
-# This is useful when using automake's parallel tests mode, to print
-# the reason for skip/failure to console, rather than to the .log files.
-: ${stderr_fileno_=2}
-
-warn_() { echo "$@" 1>&$stderr_fileno_; }
-fail_() { warn_ "$ME_: failed test: $@"; Exit 1; }
-skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; }
-framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 1; }
+# Enable glibc's malloc-perturbing option.
+# This is cheap and useful for exposing code that depends on the fact that
+# malloc-related functions often return memory that is mostly zeroed.
+# If you have the time and cycles, use valgrind to do an even better job.
+: ${MALLOC_PERTURB_=87}
+export MALLOC_PERTURB_

 # This is a stub function that is run upon trap (upon regular exit and
 # interrupt).  Override it with a per-test function, e.g., to unmount
 # a partition, or to undo any other global state changes.
 cleanup_() { :; }

-if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
+if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
   compare() { diff -u "$@"; }
-elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
+elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
   compare() { cmp -s "$@"; }
 else
   compare() { cmp "$@"; }
@@ -223,7 +249,6 @@ setup_()
   test "$VERBOSE" = yes && set -x

   initial_cwd_=$PWD
-  ME_=`expr "./$0" : '.*/\(.*\)$'`

   pfx_=`testdir_prefix_`
   test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \
--
1.7.1.556.ga4230


>From 1bd7589f30dae2466d8febab5d6571e88cbb66fe Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 16 Jun 2010 09:02:08 +0200
Subject: [PATCH 10/12] build: remove now-unnecessary replacement lstat 
definition

* libidu/walker.c [! HAVE_LSTAT] (lstat): Remove definition.
Gnulib already handles that.
---
 libidu/walker.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/libidu/walker.c b/libidu/walker.c
index d8f03d0..41785f4 100644
--- a/libidu/walker.c
+++ b/libidu/walker.c
@@ -82,14 +82,6 @@ static unsigned long dev_ino_hash_2 (void const *key);
 static int dev_ino_hash_compare (void const *x, void const *y);
 static int symlink_ancestry (struct file_link *flink);

-#ifndef HAVE_LSTAT
-#undef lstat
-int lstat(const char *filename, struct stat *sbuf)
-{
-  return stat(filename, sbuf);
-}
-#endif /* !HAVE_LSTAT */
-
 #if HAVE_LINK

 static struct file_link *find_alias_link (struct file_link *flink,
--
1.7.1.556.ga4230


>From 34d36175feb39ad66a7e025e26456b5192d0fa5a Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 16 Jun 2010 10:56:50 +0200
Subject: [PATCH 11/12] tests: clean up "consistency" and limit the number of 
files it uses

* testsuite/consistency: Use abs_top_srcdir.
Perform tests only on files under src, so it doesn't take so long.
Stop using "eval" and an explicit $bindir.
Don't re-invoke "make".  Not needed, now that $abs_top_srcdir
is exported from Makefile (via check.mk) to this script.
* testsuite/Makefile.am (consistency-real): Remove rule, now
that we no longer use it.
---
 testsuite/Makefile.am |    3 ---
 testsuite/consistency |   28 ++++++++--------------------
 2 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 2a959b0..3bb2bae 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -18,8 +18,5 @@ EXTRA_DIST =                  \

 DISTCLEANFILES = ID

-consistency-real: all
-       $(SHELL) $(srcdir)/consistency $(top_srcdir) $(top_builddir)/src
-
 AUTOMAKE_OPTIONS =
 include $(srcdir)/check.mk
diff --git a/testsuite/consistency b/testsuite/consistency
index 6e9d028..cb87f0d 100755
--- a/testsuite/consistency
+++ b/testsuite/consistency
@@ -17,25 +17,15 @@

 export LANG; LANG=C

-case $# in
-0) exec make consistency-real;;
-esac
-
-srcdir=$1
-bindir=$2
-libdir=$srcdir/libidu
-
-m_flag="-m $libdir/id-lang.map"
+lang_map="$abs_top_srcdir/libidu/id-lang.map"

 errors=

-cmd="$bindir/mkid $m_flag $srcdir"
-echo $cmd
-if eval $cmd; then
-    files="`$bindir/fnid | grep -v single_file_token_bug`"
+if mkid -m "$lang_map" $abs_top_srcdir/src; then
+    files="`fnid | grep -v single_file_token_bug`"

-    if $bindir/xtokid $m_flag $files |sort -u >ID.xti &&
-       $bindir/lid |sed -e 's/[         ].*//' |sort -u >ID.lid &&
+    if xtokid -m "$lang_map" $files |sort -u >ID.xti &&
+       lid |sed -e 's/[         ].*//' |sort -u >ID.lid &&
        cmp -s ID.xti ID.lid
     then
        rm -f ID.xti ID.lid
@@ -52,8 +42,8 @@ if eval $cmd; then

     for file in $files
     do
-       if $bindir/fid $file >$fid_file &&
-           $bindir/xtokid $m_flag $file |sort -u >$xtokid_file &&
+       if fid $file >$fid_file &&
+           xtokid -m "$lang_map" $file |sort -u >$xtokid_file &&
            cmp -s $xtokid_file $fid_file;
        then
            echo "Good.  xtokid and fid agree for $file"
@@ -70,9 +60,7 @@ else
     errors=t
 fi

-cmd="$bindir/mkid $m_flag"
-echo $cmd
-if eval $cmd; then
+if mkid -m "$lang_map"; then
     echo "Good.  No crash when dealing with single file"
 else
     1>&2 echo "Oops!  mkid failed."
--
1.7.1.556.ga4230


>From 11af652627ad1727d1708bf8effcb1aef02c11bd Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 16 Jun 2010 11:25:52 +0200
Subject: [PATCH 12/12] tests: fix "make distcheck" failure

* testsuite/help-version (mkid_setup): Tell mkid not to access
the not-yet-installed id-lang.map file.
(xtokid_setup): Likewise.
---
 testsuite/help-version |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/testsuite/help-version b/testsuite/help-version
index 10f93ad..2518f6d 100755
--- a/testsuite/help-version
+++ b/testsuite/help-version
@@ -183,11 +183,13 @@ shred_setup () { args=$tmp_in; }
 touch_setup () { args=$tmp_in2; }
 truncate_setup () { args="--reference=$tmp_in $tmp_in2"; }

-mkid_setup () { printf 'f(){}\ntypedef int t;\n' > f.c; args=. ; }
+# Specify a map, so mkid doesn't try to use the not-yet-installed id-lang.map.
+mkid_setup () {
+  printf 'f(){}\ntypedef int t;\n' > f.c; echo '*.c C' > m; args='-m m .' ; }
 lid_setup () { args=; }
 fid_setup () { args=f.c; }
 fnid_setup () { args=; }
-xtokid_setup () { args=; }
+xtokid_setup () { args='-m m'; }
 aid_setup () { args=f; }
 eid_setup () { args=--version; }
 gid_setup () { args=f; }
--
1.7.1.556.ga4230



reply via email to

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