svn commit: r213085 - stable/8/tools/regression/bin/sh/builtins

Jilles Tjoelker jilles at FreeBSD.org
Thu Sep 23 20:37:30 UTC 2010


Author: jilles
Date: Thu Sep 23 20:37:29 2010
New Revision: 213085
URL: http://svn.freebsd.org/changeset/base/213085

Log:
  MFC r212187: sh: Add a test that 'read' leaves the file pointer at the
  correct place.
  
  Naive buffering would break the common while read x... construct, which did
  not appear to be tested yet.

Added:
  stable/8/tools/regression/bin/sh/builtins/read2.0
     - copied unchanged from r212187, head/tools/regression/bin/sh/builtins/read2.0
Modified:
Directory Properties:
  stable/8/tools/regression/bin/sh/   (props changed)

Copied: stable/8/tools/regression/bin/sh/builtins/read2.0 (from r212187, head/tools/regression/bin/sh/builtins/read2.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/builtins/read2.0	Thu Sep 23 20:37:29 2010	(r213085, copy of r212187, head/tools/regression/bin/sh/builtins/read2.0)
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+set -e
+{
+	echo 1
+	echo two
+	echo three
+} | {
+	read x
+	[ "$x" = 1 ]
+	(read x
+	[ "$x" = two ])
+	read x
+	[ "$x" = three ]
+}
+
+T=`mktemp sh-test.XXXXXX`
+trap 'rm -f "$T"' 0
+{
+	echo 1
+	echo two
+	echo three
+} >$T
+{
+	read x
+	[ "$x" = 1 ]
+	(read x
+	[ "$x" = two ])
+	read x
+	[ "$x" = three ]
+} <$T


More information about the svn-src-stable mailing list