bug-grep
[Top][All Lists]
Advanced

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

five small patches


From: Jim Meyering
Subject: five small patches
Date: Sun, 07 Feb 2010 21:11:21 +0100

I'll push these tomorrow.
3/5 is a bug fix exposed by adding the tests in 5/5.
4/5 fixes a bug in the testing infrastructure.

  [PATCH 1/5] doc: adjust NEWS item
  [PATCH 2/5] maint: enable the prohibit_magic_number_exit syntax check
  [PATCH 3/5] grep: use the correct exit status (2) upon write failure, not 1
  [PATCH 4/5] tests: correct TESTS_ENVIRONMENT's PATH setting
  [PATCH 5/5] tests: add help-version sanity tests from coreutils

>From b4fb8046603e4a9c32df8cf09ecdd654bc3f4c21 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 5 Feb 2010 07:12:44 +0100
Subject: [PATCH 1/5] doc: adjust NEWS item

* NEWS: Correct a description.
---
 NEWS |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index ac5bc3a..a6c357b 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,7 @@ GNU grep NEWS                                    -*- outline -*-

 * Noteworthy changes in release ?.? (????-??-??) [?]

-  - A command line like -1 -2 or -1 -v -2 result in two lines of
+  - Using options like -1 -2 or -1 -v -2 results in two lines of
     context (the last value that appears on the command line) instead
     twelve (the concatenation of all the values).  This is consistent
     with the behavior of options -A/-B/-C.
--
1.7.0.rc1.214.gd5f8a


>From f8a8ad71920a7406a201d02b0a0c34e3ff7a2fd7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 7 Feb 2010 15:06:27 +0100
Subject: [PATCH 2/5] maint: enable the prohibit_magic_number_exit syntax check

* cfg.mk (local-checks-to-skip): Remove sc_prohibit_magic_number_exit,
to enable that check.
* src/system.h (EXIT_TROUBLE): Define.
* src/grep.c: Use symbolic names, EXIT_SUCCESS, EXIT_FAILURE, and
EXIT_TROUBLE, not 0, 1, 2.
* src/search.c: Likewise.
* src/vms_fab.c (string): Likewise.
---
 cfg.mk        |    1 -
 src/grep.c    |   33 +++++++++++++++++----------------
 src/search.c  |   32 +++++++++++++++++---------------
 src/system.h  |    2 ++
 src/vms_fab.c |    2 +-
 5 files changed, 37 insertions(+), 33 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index a867861..a6d9f80 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -26,7 +26,6 @@ local-checks-to-skip =                        \
   sc_error_message_uppercase           \
   sc_m4_quote_check                    \
   sc_makefile_TAB_only_indentation     \
-  sc_prohibit_magic_number_exit                \
   sc_prohibit_strcmp                   \
   sc_space_tab                         \
   sc_useless_cpp_parens
diff --git a/src/grep.c b/src/grep.c
index bef60b8..f15cc66 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -396,7 +396,8 @@ context_length_arg (char const *str, int *out)
         && 0 <= (*out = value)
         && *out == value))
     {
-      error (2, 0, "%s: %s\n", str, _("invalid context length argument"));
+      error (EXIT_TROUBLE, 0, "%s: %s\n", str,
+            _("invalid context length argument"));
     }
 }

@@ -657,7 +658,7 @@ add_count (uintmax_t a, uintmax_t b)
 {
   uintmax_t sum = a + b;
   if (sum < a)
-    error (2, 0, _("input is too large to count"));
+    error (EXIT_TROUBLE, 0, _("input is too large to count"));
   return sum;
 }

@@ -1047,7 +1048,7 @@ grepbuf (char const *beg, char const *lim)
          if (!outleft || done_on_match)
            {
              if (exit_on_match)
-               exit (0);
+               exit (EXIT_SUCCESS);
              after_last_match = bufoffset - (buflim - endp);
              return nlines;
            }
@@ -1529,7 +1530,7 @@ static void
 setmatcher (char const *m)
 {
   if (matcher && strcmp (matcher, m) != 0)
-    error (2, 0, _("conflicting matchers specified"));
+    error (EXIT_TROUBLE, 0, _("conflicting matchers specified"));
   matcher = m;
 }

@@ -1905,7 +1906,7 @@ main (int argc, char **argv)
        else if (strcmp (optarg, "skip") == 0)
          devices = SKIP_DEVICES;
        else
-         error (2, 0, _("unknown devices method"));
+         error (EXIT_TROUBLE, 0, _("unknown devices method"));
        break;

 #ifdef GREP_PROGRAM
@@ -1979,7 +1980,7 @@ main (int argc, char **argv)
        else if (strcmp (optarg, "recurse") == 0)
          directories = RECURSE_DIRECTORIES;
        else
-         error (2, 0, _("unknown directories method"));
+         error (EXIT_TROUBLE, 0, _("unknown directories method"));
        break;

       case 'e':
@@ -1993,7 +1994,7 @@ main (int argc, char **argv)
       case 'f':
        fp = strcmp (optarg, "-") != 0 ? fopen (optarg, "r") : stdin;
        if (!fp)
-         error (2, errno, "%s", optarg);
+         error (EXIT_TROUBLE, errno, "%s", optarg);
        for (keyalloc = 1; keyalloc <= keycc + 1; keyalloc *= 2)
          ;
        keys = xrealloc (keys, keyalloc);
@@ -2047,7 +2048,7 @@ main (int argc, char **argv)
              break;

            default:
-             error (2, 0, _("invalid max count"));
+             error (EXIT_TROUBLE, 0, _("invalid max count"));
            }
        }
        break;
@@ -2102,7 +2103,7 @@ main (int argc, char **argv)
        else if (strcmp (optarg, "without-match") == 0)
          binary_files = WITHOUT_MATCH_BINARY_FILES;
        else
-         error (2, 0, _("unknown binary-files type"));
+         error (EXIT_TROUBLE, 0, _("unknown binary-files type"));
        break;

       case COLOR_OPTION:
@@ -2140,7 +2141,7 @@ main (int argc, char **argv)
         if (add_exclude_file (add_exclude, excluded_patterns, optarg,
                              EXCLUDE_WILDCARDS, '\n') != 0)
           {
-            error (2, errno, "%s", optarg);
+            error (EXIT_TROUBLE, errno, "%s", optarg);
           }
         break;

@@ -2171,7 +2172,7 @@ main (int argc, char **argv)
        break;

       default:
-       usage (2);
+       usage (EXIT_TROUBLE);
        break;

       }
@@ -2213,11 +2214,11 @@ This is free software: you are free to change and 
redistribute it.\n\
 There is NO WARRANTY, to the extent permitted by law.\n"),
         "2009");
       printf ("\n");
-      exit (0);
+      exit (EXIT_SUCCESS);
     }

   if (show_help)
-    usage (0);
+    usage (EXIT_SUCCESS);

   if (keys)
     {
@@ -2240,7 +2241,7 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
        strcpy(keys, argv[optind++]);
       }
     else
-      usage (2);
+      usage (EXIT_TROUBLE);

 #ifdef GREP_PROGRAM
   if (! matcher)
@@ -2270,7 +2271,7 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
 #endif

   if (max_count == 0)
-    exit (1);
+    exit (EXIT_FAILURE);

   if (optind < argc)
     {
@@ -2297,6 +2298,6 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
     status = grepfile ((char *) NULL, &stats_base);

   /* We register via atexit() to test stdout.  */
-  exit (errseen ? 2 : status);
+  exit (errseen ? EXIT_TROUBLE : status);
 }
 /* vim:set shiftwidth=2: */
diff --git a/src/search.c b/src/search.c
index edcb376..cf39e0d 100644
--- a/src/search.c
+++ b/src/search.c
@@ -64,7 +64,7 @@ kwsinit (void)
       trans[i] = TOLOWER (i);

   if (!(kwset = kwsalloc (match_icase ? trans : (char *) 0)))
-    error (2, 0, _("memory exhausted"));
+    xalloc_die ();
 }

 #ifndef FGREP_PROGRAM
@@ -86,7 +86,7 @@ size_t pcount;
 void
 dfaerror (char const *mesg)
 {
-  error (2, 0, "%s", mesg);
+  error (EXIT_TROUBLE, 0, "%s", mesg);
 }

 /* Number of compiled fixed strings known to exactly match the regexp.
@@ -116,7 +116,7 @@ kwsmusts (void)
            continue;
          ++kwset_exact_matches;
          if ((err = kwsincr (kwset, dm->must, strlen (dm->must))) != NULL)
-           error (2, 0, "%s", err);
+           error (EXIT_TROUBLE, 0, "%s", err);
        }
       /* Now, we compile the substrings that will require
         the use of the regexp matcher.  */
@@ -125,10 +125,10 @@ kwsmusts (void)
          if (dm->exact)
            continue;
          if ((err = kwsincr (kwset, dm->must, strlen (dm->must))) != NULL)
-           error (2, 0, "%s", err);
+           error (EXIT_TROUBLE, 0, "%s", err);
        }
       if ((err = kwsprep (kwset)) != NULL)
-       error (2, 0, "%s", err);
+       error (EXIT_TROUBLE, 0, "%s", err);
     }
 }
 #endif /* !FGREP_PROGRAM */
@@ -248,12 +248,12 @@ GEAcompile (char const *pattern, size_t size, 
reg_syntax_t syntax_bits)

       patterns = realloc (patterns, (pcount + 1) * sizeof (*patterns));
       if (patterns == NULL)
-       error (2, errno, _("memory exhausted"));
+       error (EXIT_TROUBLE, errno, _("memory exhausted"));
       patterns[pcount] = patterns0;

       if ((err = re_compile_pattern (motif, len,
                                    &(patterns[pcount].regexbuf))) != NULL)
-       error (2, 0, "%s", err);
+       error (EXIT_TROUBLE, 0, "%s", err);
       pcount++;

       motif = sep;
@@ -547,13 +547,13 @@ COMPILE_FCT(Fcompile)
 #endif
        }
       if ((err = kwsincr (kwset, beg, end - beg)) != NULL)
-       error (2, 0, "%s", err);
+       error (EXIT_TROUBLE, 0, "%s", err);
       beg = lim;
     }
   while (beg < pattern + size);

   if ((err = kwsprep (kwset)) != NULL)
-    error (2, 0, "%s", err);
+    error (EXIT_TROUBLE, 0, "%s", err);
 }

 EXECUTE_FCT(Fexecute)
@@ -663,7 +663,9 @@ static pcre_extra *extra;
 COMPILE_FCT(Pcompile)
 {
 #if !HAVE_LIBPCRE
-  error (2, 0, "%s", _("Support for the -P option is not compiled into this 
--disable-perl-regexp binary"));
+  error (EXIT_TROUBLE, 0, "%s",
+        _("Support for the -P option is not compiled into "
+          "this --disable-perl-regexp binary"));
 #else
   int e;
   char const *ep;
@@ -676,9 +678,9 @@ COMPILE_FCT(Pcompile)

   /* FIXME: Remove these restrictions.  */
   if (eolbyte != '\n')
-    error (2, 0, _("The -P and -z options cannot be combined"));
+    error (EXIT_TROUBLE, 0, _("The -P and -z options cannot be combined"));
   if (memchr(pattern, '\n', size))
-    error (2, 0, _("The -P option only supports a single pattern"));
+    error (EXIT_TROUBLE, 0, _("The -P option only supports a single pattern"));

   *n = '\0';
   if (match_lines)
@@ -716,11 +718,11 @@ COMPILE_FCT(Pcompile)

   cre = pcre_compile (re, flags, &ep, &e, pcre_maketables ());
   if (!cre)
-    error (2, 0, "%s", ep);
+    error (EXIT_TROUBLE, 0, "%s", ep);

   extra = pcre_study (cre, 0, &ep);
   if (ep)
-    error (2, 0, "%s", ep);
+    error (EXIT_TROUBLE, 0, "%s", ep);

   free (re);
 #endif
@@ -748,7 +750,7 @@ EXECUTE_FCT(Pexecute)
          return -1;

        case PCRE_ERROR_NOMEMORY:
-         error (2, 0, _("Memory exhausted"));
+         error (EXIT_TROUBLE, 0, _("Memory exhausted"));

        default:
          abort ();
diff --git a/src/system.h b/src/system.h
index dddb026..93fdbf1 100644
--- a/src/system.h
+++ b/src/system.h
@@ -54,6 +54,8 @@
 #include <string.h>
 #include <ctype.h>

+enum { EXIT_TROUBLE = 2 };
+
 /* The extra casts work around common compiler bugs.  */
 #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
 #define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
diff --git a/src/vms_fab.c b/src/vms_fab.c
index ec3cc23..4106175 100644
--- a/src/vms_fab.c
+++ b/src/vms_fab.c
@@ -63,7 +63,7 @@ vms_fab (int * argp, char **argvp[])
   if (fab_stat != 65537)
     {
       fprintf (stderr, "No Matches found.\n");
-      exit (0);
+      exit (EXIT_SUCCESS);
     }

   /*
--
1.7.0.rc1.214.gd5f8a


>From 337bc77381729dde9318eb858e151f4a781110c5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 7 Feb 2010 15:09:03 +0100
Subject: [PATCH 3/5] grep: use the correct exit status (2) upon write failure, 
not 1

* src/grep.c (main): Initialize exit_failure to EXIT_TROUBLE.
* NEWS (Bug fixes): Mention this fix.
---
 NEWS       |   14 ++++++++++----
 src/grep.c |    1 +
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index a6c357b..82a13c2 100644
--- a/NEWS
+++ b/NEWS
@@ -2,10 +2,16 @@ GNU grep NEWS                                    -*- outline 
-*-

 * Noteworthy changes in release ?.? (????-??-??) [?]

-  - Using options like -1 -2 or -1 -v -2 results in two lines of
-    context (the last value that appears on the command line) instead
-    twelve (the concatenation of all the values).  This is consistent
-    with the behavior of options -A/-B/-C.
+** Bug fixes
+
+  grep would mistakenly exit with status 1 upon error, rather than 2,
+  as it is documented to do.
+
+  Using options like -1 -2 or -1 -v -2 results in two lines of
+  context (the last value that appears on the command line) instead
+  twelve (the concatenation of all the values).  This is consistent
+  with the behavior of options -A/-B/-C.
+

 * Noteworthy changes in release 2.5.4 (2009-02-10) [stable]

diff --git a/src/grep.c b/src/grep.c
index f15cc66..5bb7284 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1879,6 +1879,7 @@ main (int argc, char **argv)
   textdomain (PACKAGE);
 #endif

+  exit_failure = EXIT_TROUBLE;
   atexit (close_stdout);

   prepend_default_options (getenv ("GREP_OPTIONS"), &argc, &argv);
--
1.7.0.rc1.214.gd5f8a


>From 304784b9de56d255550b8870d2a22c22787a8e89 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 7 Feb 2010 15:12:05 +0100
Subject: [PATCH 4/5] tests: correct TESTS_ENVIRONMENT's PATH setting

* tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH to start with
$(abs_top_builddir)/src, so that we test the programs we've just built.
---
 tests/Makefile.am |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 223c181..5276173 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -83,7 +83,7 @@ TESTS_ENVIRONMENT =                           \
   PERL='$(PERL)'                               \
   PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)' \
   REPLACE_GETCWD=$(REPLACE_GETCWD)             \
-  PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'"$$PATH" \
+  PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \
   ; shell_or_perl_

 VERBOSE = yes
--
1.7.0.rc1.214.gd5f8a


>From 3bd25ba4afa42483cb78adfaafeab73d02116921 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 7 Feb 2010 15:13:53 +0100
Subject: [PATCH 5/5] tests: add help-version sanity tests from coreutils

* tests/help-version: New test, from coreutils.
* tests/Makefile.am (TESTS): Add it.
(TESTS_ENVIRONMENT) [built_programs]: Define it.
---
 tests/Makefile.am  |    2 +
 tests/help-version |  251 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 253 insertions(+), 0 deletions(-)
 create mode 100755 tests/help-version

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5276173..a34c38d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,6 +22,7 @@ TESTS =               \
   file.sh      \
   fmbtest.sh   \
   foad1.sh     \
+  help-version \
   khadafy.sh   \
   max-count-vs-context \
   options.sh   \
@@ -74,6 +75,7 @@ TESTS_ENVIRONMENT =                           \
   abs_top_builddir='$(abs_top_builddir)'       \
   abs_top_srcdir='$(abs_top_srcdir)'           \
   abs_srcdir='$(abs_srcdir)'                   \
+  built_programs='grep egrep fgrep'            \
   srcdir='$(srcdir)'                           \
   top_srcdir='$(top_srcdir)'                   \
   CC='$(CC)'                                   \
diff --git a/tests/help-version b/tests/help-version
new file mode 100755
index 0000000..21841e4
--- /dev/null
+++ b/tests/help-version
@@ -0,0 +1,251 @@
+#! /bin/sh
+# Make sure all these programs work properly
+# when invoked with --help or --version.
+
+# Copyright (C) 2000-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
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+test "$VERBOSE" = yes && set -x
+
+# Ensure that $SHELL is set to *some* value and exported.
+# This is required for dircolors, which would fail e.g., when
+# invoked via debuild (which removes SHELL from the environment).
+test "x$SHELL" = x && SHELL=/bin/sh
+export SHELL
+
+: ${srcdir=.}
+. "$srcdir/init.sh"
+
+expected_failure_status_chroot=125
+expected_failure_status_env=125
+expected_failure_status_nice=125
+expected_failure_status_nohup=125
+expected_failure_status_stdbuf=125
+expected_failure_status_su=125
+expected_failure_status_timeout=125
+expected_failure_status_printenv=2
+expected_failure_status_tty=3
+expected_failure_status_sort=2
+expected_failure_status_expr=3
+expected_failure_status_lbracket=2
+expected_failure_status_dir=2
+expected_failure_status_ls=2
+expected_failure_status_vdir=2
+
+expected_failure_status_cmp=2
+expected_failure_status_zcmp=2
+expected_failure_status_sdiff=2
+expected_failure_status_diff3=2
+expected_failure_status_diff=2
+expected_failure_status_zdiff=2
+expected_failure_status_zgrep=2
+expected_failure_status_zegrep=2
+expected_failure_status_zfgrep=2
+
+expected_failure_status_grep=2
+expected_failure_status_egrep=2
+expected_failure_status_fgrep=2
+
+test "$built_programs" \
+  || { echo "$this_test: no programs built!?!" 1>&2; Exit 1; }
+
+for lang in C fr da; do
+  for i in $built_programs; do
+
+    # Skip `test'; it doesn't accept --help or --version.
+    test $i = test && continue;
+
+    # false fails even when invoked with --help or --version.
+    if test $i = false; then
+      env LC_MESSAGES=$lang $i --help >/dev/null && fail=1
+      env LC_MESSAGES=$lang $i --version >/dev/null && fail=1
+      continue
+    fi
+
+    # The just-built install executable is always named `ginstall'.
+    test $i = install && i=ginstall
+
+    # Make sure they exit successfully, under normal conditions.
+    env $i --help    > h-$i     || fail=1
+    env $i --version >/dev/null || fail=1
+
+    # Make sure they mention the bug-reporting address in --help output.
+    grep "$PACKAGE_BUGREPORT" h-$i > /dev/null || fail=1
+    rm -f h-$i
+
+    # Make sure they fail upon `disk full' error.
+    if test -w /dev/full && test -c /dev/full; then
+      env $i --help    >/dev/full 2>/dev/null && fail=1
+      env $i --version >/dev/full 2>/dev/null && fail=1
+      status=$?
+      test $i = [ && prog=lbracket || prog=$i
+      eval "expected=\$expected_failure_status_$prog"
+      test x$expected = x && expected=1
+      if test $status = $expected; then
+        : # ok
+      else
+        fail=1
+        echo "*** $i: bad exit status \`$status' (expected $expected)," 1>&2
+        echo "  with --help or --version output redirected to /dev/full" 1>&2
+      fi
+    fi
+  done
+done
+
+bigZ_in=bigZ-in.Z
+zin=zin.gz
+zin2=zin2.gz
+
+tmp=tmp-$$
+tmp_in=in-$$
+tmp_in2=in2-$$
+tmp_dir=dir-$$
+tmp_out=out-$$
+mkdir $tmp || fail=1
+cd $tmp || fail=1
+
+comm_args="$tmp_in $tmp_in"
+csplit_args="$tmp_in //"
+cut_args='-f 1'
+join_args="$tmp_in $tmp_in"
+tr_args='a a'
+
+chmod_args="a+x $tmp_in"
+# Punt on these.
+chgrp_args=--version
+chown_args=--version
+mkfifo_args=--version
+mknod_args=--version
+# Punt on uptime, since it fails (e.g., failing to get boot time)
+# on some systems, and we shouldn't let that stop `make check'.
+uptime_args=--version
+
+# Create a file in the current directory, not in $TMPDIR.
+mktemp_args=mktemp.XXXX
+
+cmp_args="$tmp_in $tmp_in2"
+
+# Tell dd not to print the line with transfer rate and total.
+# The transfer rate would vary between runs.
+dd_args=status=noxfer
+
+zdiff_args="$zin $zin2"
+zcmp_args="$zin $zin2"
+zcat_args=$zin
+gunzip_args=$zin
+zmore_args=$zin
+zless_args=$zin
+znew_args=$bigZ_in
+zforce_args=$zin
+zgrep_args="z $zin"
+zegrep_args="z $zin"
+zfgrep_args="z $zin"
+gzexe_args=$tmp_in
+
+# We know that $tmp_in contains a "0"
+grep_args="0 $tmp_in"
+egrep_args="0 $tmp_in"
+fgrep_args="0 $tmp_in"
+
+diff_args="$tmp_in $tmp_in2"
+sdiff_args="$tmp_in $tmp_in2"
+diff3_args="$tmp_in $tmp_in2 $tmp_in2"
+cp_args="$tmp_in $tmp_in2"
+ln_args="$tmp_in ln-target"
+ginstall_args="$tmp_in $tmp_in2"
+mv_args="$tmp_in $tmp_in2"
+mkdir_args=$tmp_dir/subdir
+rmdir_args=$tmp_dir
+rm_args=$tmp_in
+shred_args=$tmp_in
+touch_args=$tmp_in2
+truncate_args="--reference=$tmp_in $tmp_in2"
+
+basename_args=$tmp_in
+dirname_args=$tmp_in
+expr_args=foo
+
+# Punt, in case GNU `id' hasn't been installed yet.
+groups_args=--version
+
+pathchk_args=$tmp_in
+yes_args=--version
+logname_args=--version
+nohup_args=--version
+printf_args=foo
+seq_args=10
+sleep_args=0
+su_args=--version
+stdbuf_args="-oL true"
+timeout_args=--version
+
+# I'd rather not run sync, since it spins up disks that I've
+# deliberately caused to spin down (but not unmounted).
+sync_args=--version
+
+test_args=foo
+
+# This is necessary in the unusual event that there is
+# no valid entry in /etc/mtab.
+df_args=/
+
+# This is necessary in the unusual event that getpwuid (getuid ()) fails.
+id_args=-u
+
+# Use env to avoid invoking built-in sleep of Solaris 11's /bin/sh.
+env sleep 10m &
+kill_args=$!
+
+link_args="$tmp_in link-target"
+unlink_args=$tmp_in
+
+ln -s . slink
+readlink_args=slink
+
+stat_args=$tmp_in
+unlink_args=$tmp_in
+lbracket_args=": ]"
+
+# Ensure that each program "works" (exits successfully) when doing
+# something more than --help or --version.
+for i in $built_programs; do
+  # Skip these.
+  case $i in chroot|stty|tty|false|chcon|runcon) continue;; esac
+
+  rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out $bigZ_in $zin $zin2
+  echo z |gzip > $zin
+  cp $zin $zin2
+  cp $zin $bigZ_in
+
+  # This is sort of kludgey: use numbers so this is valid input for factor,
+  # and two tokens so it's valid input for tsort.
+  echo 2147483647 0 > $tmp_in
+  # Make $tmp_in2 identical. Then, using $tmp_in and $tmp_in2 as arguments
+  # to the likes of cmp and diff makes them exit successfully.
+  cp $tmp_in $tmp_in2
+  mkdir $tmp_dir
+  # echo ================== $i
+  test $i = [ && prog=lbracket || prog=$i
+  eval "args=\$${prog}_args"
+  if env $i $args < $tmp_in > $tmp_out; then
+    : # ok
+  else
+    echo FAIL: $i
+    fail=1
+  fi
+  rm -rf $tmp_in $tmp_in2 $tmp_out $tmp_dir
+done
+
+Exit $fail
--
1.7.0.rc1.214.gd5f8a




reply via email to

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