summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-02-08 10:00:38 +0000
committerJim Meyering <jim@meyering.net>2004-02-08 10:00:38 +0000
commit400a1fc781b11dc00c47880138f43052b006c3da (patch)
tree30077fe30e6f7b645e7e96d4473ca434490eca0d
parent8c756b5ed6f71101f34565d25b5be4bf7c85ff26 (diff)
downloadcoreutils-400a1fc781b11dc00c47880138f43052b006c3da.tar.xz
Avoid triggering a bug in OSF/Tru64's sed
that would cause an unwarranted test failure.
-rwxr-xr-xtests/rm/rm310
-rwxr-xr-xtests/rm/rm510
2 files changed, 14 insertions, 6 deletions
diff --git a/tests/rm/rm3 b/tests/rm/rm3
index 018c4ae66..98b7ff9bf 100755
--- a/tests/rm/rm3
+++ b/tests/rm/rm3
@@ -49,9 +49,13 @@ EOF
# Both of these should fail.
rm -ir z < in > out 2>&1 || fail=1
-# The following loses with Tru64's sed, since that sed mistakenly
-# tacks a newline onto the end of the file.
-tr '?' '\n' < out |sed 's/^ //' |sort > o2
+
+# Given input like `rm: ...? rm: ...? ' (no trailing newline),
+# the `head...' part of the pipeline below removes the trailing space, so
+# that sed doesn't have to deal with a line lacking a terminating newline.
+# This avoids a bug whereby some vendor-provided (Tru64) versions of sed
+# would mistakenly tack a newline onto the end of the output.
+tr '?' '\n' < out | head --bytes=-1 | sed 's/^ //' |sort > o2
mv o2 out
sort <<EOF > exp || fail=1
diff --git a/tests/rm/rm5 b/tests/rm/rm5
index 91715ae75..a1f3231af 100755
--- a/tests/rm/rm5
+++ b/tests/rm/rm5
@@ -39,9 +39,13 @@ fi
fail=0
rm -ir d < in > out 2>&1 || fail=1
-# The following loses with Tru64's sed, since that sed mistakenly
-# tacks a newline onto the end of the file.
-tr '?' '\n' < out |sed 's/^ //' > o2
+
+# Given input like `rm: ...? rm: ...? ' (no trailing newline),
+# the `head...' part of the pipeline below removes the trailing space, so
+# that sed doesn't have to deal with a line lacking a terminating newline.
+# This avoids a bug whereby some vendor-provided (Tru64) versions of sed
+# would mistakenly tack a newline onto the end of the output.
+tr '?' '\n' < out | head --bytes=-1 | sed 's/^ //' > o2
mv o2 out
# Make sure it's been removed.