bug-grep
[Top][All Lists]
Advanced

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

Re: grep: foad1.sh tests fail for grep 2.5.4 on Mac OS X


From: Jim Meyering
Subject: Re: grep: foad1.sh tests fail for grep 2.5.4 on Mac OS X
Date: Sun, 21 Feb 2010 20:32:09 +0100

Daniel Richman wrote:
> Some of the tests in foad1.sh fail with the grep I compiled (both
> using Apple's gcc-4.0.1 and the standard GNU gcc-4.3.1). I'm attaching
> the output of just that script, since all the other scripts are fine.
>
> Many of the tests seem to have just an extra "-n " at the beginning of
> the output line.
>
> Please let me know if I can be if further assistance.

Thanks for the report.
Here's a fix for the "-n"-related problems.

Once it's applied, do others remain?

>From 8f9395ea428a27690e10f55b581c93e1226c87b7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 21 Feb 2010 20:30:49 +0100
Subject: [PATCH] tests: don't use "echo -n"

* tests/foad1.sh: Use printf, not echo -n.  The latter is not portable.
Reported by Daniel Richman.
---
 tests/foad1.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/foad1.sh b/tests/foad1.sh
index 7a196bb..7c16d00 100755
--- a/tests/foad1.sh
+++ b/tests/foad1.sh
@@ -23,7 +23,7 @@ grep_test ()
   INPUT="$1"
   EXPECT="$2"
   shift 2
-  OUTPUT=`echo -n "$INPUT" | tr "/" "\n" | "$GREP" "$@" | tr "\n" "/"`
+  OUTPUT=`printf %s "$INPUT" | tr "/" "\n" | "$GREP" "$@" | tr "\n" "/"`
   if test "$OUTPUT" != "$EXPECT" || test "$VERBOSE" = "1"; then
     echo "Testing:  $GREP $@"
     test "$LC_ALL" != C && test "$LC_ALL" != "" && echo "  LC_ALL: \"$LC_ALL\""
--
1.7.0.262.gef208




reply via email to

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