]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Avoid triggering a bug in OSF/Tru64's sed
authorJim Meyering <jim@meyering.net>
Sun, 8 Feb 2004 10:00:38 +0000 (10:00 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 8 Feb 2004 10:00:38 +0000 (10:00 +0000)
that would cause an unwarranted test failure.

tests/rm/rm3
tests/rm/rm5

index 018c4ae66574dd43c8f25617cadb8398da53d96c..98b7ff9bf2b078e523fe808a1976fa03a5977954 100755 (executable)
@@ -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
index 91715ae75b7aeefd2aaaef34df0bf26acf98b7de..a1f3231af746d0a539e58e08a0b529a8820425de 100755 (executable)
@@ -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.