summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordds <dds@FreeBSD.org>2003-07-22 19:22:08 +0000
committerdds <dds@FreeBSD.org>2003-07-22 19:22:08 +0000
commit739de7fe1d94a86dc496c9626306b2d782ac0aa9 (patch)
tree40c26c98c351f8bb819ae5b8d6acecb06fa2f014
parent7bf3355d382e17458287f76436e7959c88d04766 (diff)
downloadFreeBSD-src-739de7fe1d94a86dc496c9626306b2d782ac0aa9.zip
FreeBSD-src-739de7fe1d94a86dc496c9626306b2d782ac0aa9.tar.gz
Test 8.16 in sed.test tests the ability of a sed to handle an empty
regular expression as the first argument to a substitute command. If used to test a sed which (erroneously) evaluates this at translation time rather than at execution time, the bugged sed is put into an infinite loop. This mode of failure seems excessive. Such a failing sed is the Free Software Foundation's sed 3.02. The specific test was also not being executed for the BSD sed. Both problems are now fixed. PR: misc/25585 Submitted by: Walter Briscoe <w.briscoe@ponl.com> Approved by: schweikh (mentor) MFC after: 2 weeks
-rw-r--r--tools/regression/usr.bin/sed/multitest.t30
-rw-r--r--tools/regression/usr.bin/sed/sed.test30
-rw-r--r--usr.bin/sed/TEST/sed.test30
3 files changed, 57 insertions, 33 deletions
diff --git a/tools/regression/usr.bin/sed/multitest.t b/tools/regression/usr.bin/sed/multitest.t
index 71c7f20..793dbe3 100644
--- a/tools/regression/usr.bin/sed/multitest.t
+++ b/tools/regression/usr.bin/sed/multitest.t
@@ -34,6 +34,8 @@
#
# @(#)sed.test 8.1 (Berkeley) 6/6/93
#
+# $FreeBSD$
+#
# sed Regression Tests
#
@@ -430,11 +432,7 @@ test_print()
</dev/null >lines3
# GNU and SunOS sed behave differently here
mark '7.1'
- if [ $BSD -eq 1 ] ; then
- echo 'BSD sed drops core on this one; TEST SKIPPED'
- else
- $SED -n l lines3
- fi
+ $SED -n l lines3
mark '7.2' ; $SED -e '/l2_/=' lines1 lines2
rm -f lines4
mark '7.3' ; $SED -e '3,12w lines4' lines1
@@ -501,12 +499,22 @@ u2/g' lines1
fi
mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
mark '8.16'
- if [ $BSD -eq 1 ] ; then
- echo 'BSD sed does not handle branch defined REs'
- else
- echo 'eeefff' | $SED -e 'p' -e 's/e/X/p' -e ':x' \
- -e 's//Y/p' -e '/f/bx'
- fi
+ echo 'eeefff' | $SED -e '
+ p
+ s/e/X/p
+ :x
+ s//Y/p
+ # Establish limit counter in the hold space
+ # GNU sed version 3.02 enters into an infinite loop here
+ x
+ /.\{10\}/ {
+ s/.*/ERROR/
+ b
+ }
+ s/.*/&./
+ x
+ /f/bx
+ '
}
test_error()
diff --git a/tools/regression/usr.bin/sed/sed.test b/tools/regression/usr.bin/sed/sed.test
index 71c7f20..793dbe3 100644
--- a/tools/regression/usr.bin/sed/sed.test
+++ b/tools/regression/usr.bin/sed/sed.test
@@ -34,6 +34,8 @@
#
# @(#)sed.test 8.1 (Berkeley) 6/6/93
#
+# $FreeBSD$
+#
# sed Regression Tests
#
@@ -430,11 +432,7 @@ test_print()
</dev/null >lines3
# GNU and SunOS sed behave differently here
mark '7.1'
- if [ $BSD -eq 1 ] ; then
- echo 'BSD sed drops core on this one; TEST SKIPPED'
- else
- $SED -n l lines3
- fi
+ $SED -n l lines3
mark '7.2' ; $SED -e '/l2_/=' lines1 lines2
rm -f lines4
mark '7.3' ; $SED -e '3,12w lines4' lines1
@@ -501,12 +499,22 @@ u2/g' lines1
fi
mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
mark '8.16'
- if [ $BSD -eq 1 ] ; then
- echo 'BSD sed does not handle branch defined REs'
- else
- echo 'eeefff' | $SED -e 'p' -e 's/e/X/p' -e ':x' \
- -e 's//Y/p' -e '/f/bx'
- fi
+ echo 'eeefff' | $SED -e '
+ p
+ s/e/X/p
+ :x
+ s//Y/p
+ # Establish limit counter in the hold space
+ # GNU sed version 3.02 enters into an infinite loop here
+ x
+ /.\{10\}/ {
+ s/.*/ERROR/
+ b
+ }
+ s/.*/&./
+ x
+ /f/bx
+ '
}
test_error()
diff --git a/usr.bin/sed/TEST/sed.test b/usr.bin/sed/TEST/sed.test
index 71c7f20..793dbe3 100644
--- a/usr.bin/sed/TEST/sed.test
+++ b/usr.bin/sed/TEST/sed.test
@@ -34,6 +34,8 @@
#
# @(#)sed.test 8.1 (Berkeley) 6/6/93
#
+# $FreeBSD$
+#
# sed Regression Tests
#
@@ -430,11 +432,7 @@ test_print()
</dev/null >lines3
# GNU and SunOS sed behave differently here
mark '7.1'
- if [ $BSD -eq 1 ] ; then
- echo 'BSD sed drops core on this one; TEST SKIPPED'
- else
- $SED -n l lines3
- fi
+ $SED -n l lines3
mark '7.2' ; $SED -e '/l2_/=' lines1 lines2
rm -f lines4
mark '7.3' ; $SED -e '3,12w lines4' lines1
@@ -501,12 +499,22 @@ u2/g' lines1
fi
mark '8.15' ; $SED -e '1N;2y/\n/X/' lines1
mark '8.16'
- if [ $BSD -eq 1 ] ; then
- echo 'BSD sed does not handle branch defined REs'
- else
- echo 'eeefff' | $SED -e 'p' -e 's/e/X/p' -e ':x' \
- -e 's//Y/p' -e '/f/bx'
- fi
+ echo 'eeefff' | $SED -e '
+ p
+ s/e/X/p
+ :x
+ s//Y/p
+ # Establish limit counter in the hold space
+ # GNU sed version 3.02 enters into an infinite loop here
+ x
+ /.\{10\}/ {
+ s/.*/ERROR/
+ b
+ }
+ s/.*/&./
+ x
+ /f/bx
+ '
}
test_error()
OpenPOWER on IntegriCloud