Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.1453.2.608
diff -u -r1.1453.2.608 ChangeLog
--- ChangeLog	14 Mar 2006 22:51:07 -0000	1.1453.2.608
+++ ChangeLog	14 Mar 2006 23:33:25 -0000
@@ -1,5 +1,11 @@
 2006-03-14  Andreas Kupries <andreask@activestate.com>
 
+	* generic/tclPipe.c (TclCreatePipeline): Modified the processing
+	  of pipebars to fail if the last bar is followed only by
+	  redirections. [Bug 768659].
+
+2006-03-14  Andreas Kupries <andreask@activestate.com>
+
 	* doc/fconfigure.n: Clarified that -translation is binary is
 	  reported as lf when queried, because it is identical to lf,
 	  except for the special additional behaviour when setting
Index: generic/tclPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPipe.c,v
retrieving revision 1.7.2.4
diff -u -r1.7.2.4 tclPipe.c
--- generic/tclPipe.c	16 Jan 2006 19:31:18 -0000	1.7.2.4
+++ generic/tclPipe.c	14 Mar 2006 23:33:25 -0000
@@ -508,7 +508,7 @@
     int errorRelease = 0;
     CONST char *p;
     CONST char *nextArg;
-    int skip, lastBar, lastArg, i, j, atOK, flags, errorToOutput = 0;
+    int skip, lastBar, lastArg, i, j, atOK, flags, needCmd, errorToOutput = 0;
     Tcl_DString execBuffer;
     TclFile pipeIn;
     TclFile curInFile, curOutFile, curErrFile;
@@ -546,6 +546,7 @@
 
     lastBar = -1;
     cmdCount = 1;
+    needCmd = 1;
     for (i = 0; i < argc; i++) {
 	errorToOutput = 0;
 	skip = 0;
@@ -565,6 +566,7 @@
 	    }
 	    lastBar = i;
 	    cmdCount++;
+	    needCmd = 1;
 	    break;
 
 	case '<':
@@ -706,6 +708,11 @@
 		}
 	    }
 	    break;
+
+	default:
+	  /* Got a command word, not a redirection */
+	  needCmd = 0;
+	  break;
 	}
 
 	if (skip != 0) {
@@ -717,6 +724,15 @@
 	}
     }
 
+    if (needCmd) {
+        /* We had a bar followed only by redirections. */
+
+        Tcl_SetResult(interp,
+		      "illegal use of | or |& in command",
+		      TCL_STATIC);
+	goto error;
+    }
+
     if (inputFile == NULL) {
 	if (inputLiteral != NULL) {
 	    /*
