Skip to content
Tcl Source Code View Ticket
Login

View Ticket

eofchar change: strange buffer limit ?

Closed / Fixed930851ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2004-04-07 05:01:14
Annotated interactive tclsh session:

% set f [open ../generic/tclVar.c r]
file3

           open a file I know aku has.

% fconfigure $f
-blocking 1 -buffering full -buffersize 4096 -encoding
iso8859-1 -eofchar {} -translation auto
% fconfigure $f -eofchar =

           set eof char to something unusual

% read $f; tell $f
834

            read to "EOF"  -- the first eof char

% fconfigure $f -eofchar {}

            Change back to no eof char

% read $f 1
=

             See, we read up to that =

             Now lets read the rest of the file:

% read $f; tell $f
4096

             What's this?  It looks like only one
             buffer got filled, and then it quit.

% seek $f 0 start
% read $f; tell $f
147065

              A [seek] to the beginning of the file
              restores normal [read] to EOF.

Bug, undocumented feature, or pilot error?
dgpplain2004-04-07 23:11:41
Logged In: YES 
user_id=80530


Perhaps there's some internal
flag that needs to be reset when
the -eofchar changes?
andreas_kupriesplain2004-04-24 05:56:30
Logged In: YES 
user_id=75003

Chat log

aku - From the description it looks like a bug where
internal flags of the channel are not properly changed when
changing the eofchar. Most likely something like stick_eof

dgp - aku, it appears that any [seek] at all, even [seek $f
0 current] will workaround the problem
andreas_kupriesplain2004-04-24 06:42:59
Logged In: YES 
user_id=75003

Yes, the seek zaps a number of flags which should be zapped
when changing the eofchars as well. Added testcases, added
fix. Testsuite is ok with fix. New testcase fails before
fix, and is ok after. Committed to both 8.4 and head.
Log in (anonymous is fine) to add a comment.