Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-23
01:54 • Closed ticket [218183ffff]: this patch fixes incorrect buffering prob plus 3... artifact: edee2ac825 user: dgp
01:52 • Open ticket [218183ffff]. artifact: 9de835aeb8 user: dgp
2000-10-26
08:16 • Closed ticket [218183ffff]. artifact: 54d0a86f6c user: welch
00:54 • New ticket [218183ffff]. artifact: de6bbf2288 user: nobody

this patch fixes incorrect buffering prob

Closed / Fixed218183ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:54:14
OriginalBugID: 2335 Bug
Version: 8.1.1
SubmitDate: '1999-07-07'
LastModified: '1999-07-07'
Severity: MED
Status: Closed
Submitter: techsupp
ChangedBy: stanton
OS: Solaris
OSVersion: SunOS muffin 5.6 Generic sun4m sparc SUNW,SPARCstation-20
Machine: Other
FixedDate: '1999-07-07'
ClosedDate: '1999-07-07'


Name:

Don Libes



CVS:

* RCS: @(#) $Id: tclUnixChan.c,v 1.10 1999/04/16 00:48:04 stanton Exp $



Comments:

This patch makes the fconfigure man page accurate where it says:

    

                                        The  default  is for

     -buffering to be set to full except for  channels  that

     connect  to  terminal-like  devices; for these channels

     the initial setting is line.



ReproducibleScript:

Call the following script "foo":

    ##### foo ######

    puts a

    puts b

    ##### end of foo ######

    

    From the command line, do this:

    % truss -twrite tclsh foo > /dev/null



ObservedBehavior:

write(1, " a\n", 2)                             = 2

    write(1, " b\n", 2)                             = 2

    

    This is incorrect behavior.  The man page says that file channels are

    full-buffered (by default) unless they are ttys.  Here, we see

    /dev/null

    is behaving line-buffered, not full-buffered.



DesiredBehavior:

write(1, " a\n b\n", 4)                         = 4



Patch:

*** tclUnixChan.cTue Jul  6 12:43:18 1999

--- /tmp/tclUnixChan.cTue Jul  6 12:33:04 1999

***************

*** 2409,2415 ****

              }

      fd = 0;

      mode = TCL_READABLE;

!             bufMode = "line";

              break;

          case TCL_STDOUT:

              if ((lseek(1, (off_t) 0, SEEK_CUR) == -1) &&

--- 2409,2416 ----

              }

      fd = 0;

      mode = TCL_READABLE;

!     if (isatty(fd)) bufMode = "line";

!     else bufMode = "full";

              break;

          case TCL_STDOUT:

              if ((lseek(1, (off_t) 0, SEEK_CUR) == -1) &&

***************

*** 2418,2424 ****

              }

      fd = 1;

      mode = TCL_WRITABLE;

!             bufMode = "line";

              break;

          case TCL_STDERR:

              if ((lseek(2, (off_t) 0, SEEK_CUR) == -1) &&

--- 2419,2426 ----

              }

      fd = 1;

      mode = TCL_WRITABLE;

!     if (isatty(fd)) bufMode = "line";

!     else bufMode = "full";

              break;

          case TCL_STDERR:

              if ((lseek(2, (off_t) 0, SEEK_CUR) == -1) &&



PatchFiles:

tclUnixChan.c





07/07/1999 11:15 - stanton - This patch introduces a backwards incompatibility that may break many scripts.  It definitely causes hangs in the test suite (e.g. io.test) because many tests assume that Tcl is in line mode on the stdio channels.
welch Closed ticket [218183ffff]. [History diff]2000-10-26 08:16:55
dgp Open ticket [218183ffff]. [History diff]2001-04-23 01:52:05
dgp Closed ticket [218183ffff]. [History diff]2001-04-23 01:54:04
Log in (anonymous is fine) to add a comment.