bug-grep
[Top][All Lists]
Advanced

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

[PATCH] tests: avoid failure when using Solaris 10's sed


From: Jim Meyering
Subject: [PATCH] tests: avoid failure when using Solaris 10's sed
Date: Fri, 02 Mar 2012 09:42:00 +0100

On Solaris 10, with /bin early in my PATH, one of grep's tests failed:

  FAIL: reversed-range-endpoints
  ==============================
  ...
  + for prog in grep egrep ''\''grep -E'\'''
  + grep '[b-a]'
  + test 2 = 2
  + sed 's/^\([A-Za-z]:\)\{0,1\}[^: ]*: //' out
  + mv k out
  + compare exp out
  + compare_dev_null_ exp out
  + test 2 = 2
  + test xexp = x/dev/null
  + test xout = x/dev/null
  + return 2
  + case $? in
  + compare_ exp out
  + diff -u exp out
  + cat diff.out
  --- exp Fri Mar  2 00:44:09 2012
  +++ out Fri Mar  2 00:44:09 2012
  @@ -1,1 +1,1 @@
  -Invalid range end
  +grep: Invalid range end

The fix was simple: replace the baroque and obviously non-portable
sed expression with a simpler one:

>From 6495328815d75827338c0742b598b92e934ee24d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 2 Mar 2012 09:30:48 +0100
Subject: [PATCH] tests: avoid failure when using Solaris 10's sed

* tests/reversed-range-endpoints: Use a simpler sed expression to
sanitize actual output, so it also works with Solaris 10's /bin/sed.
---
 tests/reversed-range-endpoints |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/reversed-range-endpoints b/tests/reversed-range-endpoints
index 87a3331..a20f0a2 100755
--- a/tests/reversed-range-endpoints
+++ b/tests/reversed-range-endpoints
@@ -10,8 +10,8 @@ for prog in grep egrep 'grep -E'; do
   # exit status must be 2, not 1
   test $? = 2 || fail=1

-  # Remove "program_name: " prefix from actual output.
-  sed 's/^\([A-Za-z]:\)\{0,1\}[^: ]*: //' out > k && mv k out
+  # Remove "$prog: " prefix from actual output.
+  sed 's/^[grep]*: //' out > k && mv k out

   compare exp out || fail=1
 done
--
1.7.9.2.324.g1221



reply via email to

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