Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 540c8e8136202e96b95a78d70be0ef1cf53d0416
Ticket: 217793ffffffffffffffffffffffffffffffffff
Writing to a channel fconfigure with -crlf sometimes corrupt
User & Date: nobody on 2000-10-26 00:43:45
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 923 Bug
    Version: 8.1a2
    SubmitDate: '1998-12-04'
    LastModified: '1998-12-07'
    Severity: SER
    Status: Closed
    Submitter: welch
    ChangedBy: stanton
    RelatedBugIDs: 887
    OS: Windows NT
    Machine: X86
    FixedDate: '2000-10-25'
    ClosedDate: '1998-12-07'
    
    
    Name:
    
    Syd Polk
    
    
    CVS:
    
    12-02-1998 tclIO.c revision 1.1.2.4
    
    
    ReproducibleScript:
    
    # Test 1 - Case that works
    
    set bigstring {}
    
    
    for {set i 0} {$i < 10000} {incr i} {
    
    append bigstring "0"
    
    }
    
    
    set f [open foo.out w]
    
    fconfigure $f -translation crlf
    
    puts $f $bigstring nonewline
    
    close $f
    
    
    set f [open foo.out]
    
    fconfigure $f -translation crlf
    
    set readstring [read $f]
    
    close $f
    
    catch {file delete -force foo.out}
    
    
    if {[string compare $bigstring $readstring] != 0} {
    
    puts "Test 1 did not work"
    
    }
    
    
    # Test 2 - Fails
    
    
    set bigstring {}
    
    
    for {set i 0} {$i < 10000} {incr i} {
    
    append bigstring "000000000\n"
    
    }
    
    
    set f [open foo.out w]
    
    fconfigure $f -translation crlf
    
    puts $f $bigstring nonewline
    
    close $f
    
    
    set f [open foo.out]
    
    fconfigure $f -translation crlf
    
    set readstring [read $f]
    
    close $f
    
    catch {file delete -force foo.out}
    
    
    if {[string compare $bigstring $readstring] != 0} {
    
    puts "Test 2 did not work"
    
    }
    
    
    ObservedBehavior:
    
    The script complains that the data read in does not match the data written out.
    
    
    DesiredBehavior:
    
    No complaints.
    
    
    Patch:
    
    *** tclIO.cWed Dec  2 18:49:57 1998
    
    --- tclIO.new.cWed Dec  2 18:49:32 1998
    
    ***************
    
    *** 2561,2566 ****
    
    --- 2561,2567 ----
    
          total += dstWrote;
    
          stage += stageRead;
    
          stageLen -= stageRead;
    
    +     sawLF = 0;
    
      }
    
          }
    
          return total;
    
    ***************
    
    *** 2672,2678 ****
    
    
          srcStart = src;
    
    
    !     for (dstEnd = dst + srcLen; dst < dstEnd; ) {
    
      if (*src == '\n') {
    
          if (dstEnd < dstMax) {
    
      dstEnd++;
    
    --- 2673,2680 ----
    
    
          srcStart = src;
    
    
    !     for (dstEnd = dst + (srcLen < *dstLenPtr ? srcLen : *dstLenPtr); 
    
    !     dst < dstEnd; ) {
    
      if (*src == '\n') {
    
          if (dstEnd < dstMax) {
    
      dstEnd++;
    
    
    PatchFiles:
    
    generic/tclIO.c
    
    
    
    
    Your bug form spellls concatentate wrong in step 9.
    
    
  4. foundin changed to: "obsolete: 8.1a2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to:
    Writing to a channel fconfigure with -crlf sometimes corrupt
    
  11. type changed to: "Bug"