Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6bad4e2b7be491b493aefee0a0b5502f9f060228930f500924fe68131b9a37f4
Ticket: 4c5a98f5a0d4ae30a0f1bb4d76592f3ba3551bd1
gets with -translation auto merges lines after a "\r" at the end of a read
User & Date: jan.nijtmans on 2026-11-22 22:56:47
Changes

  1. assignee changed to: "jan.nijtmans"
  2. closedate changed to: "2461367.4561011572"
  3. closer changed to: "jan.nijtmans"
  4. 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.
    
  5. icomment:
    Merged to [1bcbef3166|trunk], core-9-0-branch and core-8-6-branch
    
    Many thanks!
    
  6. login: "jan.nijtmans"
  7. mimetype: "text/x-fossil-wiki"
  8. resolution changed to: "Fixed"
  9. status changed to: "Closed"