Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 973cabdbd387fdcaf1f25efd32aad88fe7feae87d1f1b0cf3b4a8873f75ef951
Ticket: 4c5a98f5a0d4ae30a0f1bb4d76592f3ba3551bd1
gets with -translation auto merges lines after a "\r" at the end of a read
User & Date: serhiy.storchaka on 2026-10-16 21:38:18
Changes

  1. cmimetype changed to: "text/x-fossil-wiki"
  2. comment changed to:
    With <nowiki>-translation auto</nowiki>, if a read ends with "\r" and the next read has no end of line, a "\n" at the start of a later read is dropped as if it were the LF of a CRLF pair:
    
    <verbatim>
    lassign [chan pipe] r w
    fconfigure $r -blocking 0 -translation auto
    fconfigure $w -translation binary -buffering none
    puts -nonewline $w "a\r"; gets $r      ;# a
    puts -nonewline $w "b"; gets $r        ;# (blocked)
    puts -nonewline $w "\nc\n"; gets $r    ;# bc  (8.6.12: b, then c)
    </verbatim>
    
    LF CR input loses empty lines in the same way. Since [a3ed092aab] (8.6.13, the fix for [b3977d199b]) Tcl_GetsObj() resets INPUT_SAW_CR only when an end of line is found.
    
  3. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
  4. login: "serhiy.storchaka"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. severity changed to: "Minor"
  8. status changed to: "Open"
  9. submitter changed to: "serhiy.storchaka"
  10. subsystem changed to: "25. Channel System"
  11. title changed to:
    gets with -translation auto merges lines after a "\r" at the end of a read
    
  12. type changed to: "Bug"