Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a71a2f5c40ff64f1398534f01fa5f1e252a7006ca66868f62a71a218fec2419f
Ticket: a173f9229fe2fec80dc8d43a16c1d7366fb11945
fcopy and encoding errors: no partial write, no transparency write
User & Date: oehhar on 2023-11-17 08:02:51
Changes

  1. icomment:
    Hi Jan,
    
    thank you for the good thoughts.
    
    Even if there is data loss possible on the 3rd case, I would just accept that data loss.
    
    The fcopy logically as:
    
    <verbatim>
    if {[catch {read $rf} data]} {
        # read error handling
    } elseif {[catch {puts -nonewline $wf $data} err]} {
        # write data error
    }  
    </verbatim>
    
    Currently, if we loose data on the puts, it is lost - point.
    
    So, I would go to document for fcopy on encoding errors:
    
       *   On read encoding errors, the data before the error is written. The current read file pointer is on the error position. A recovery is possible by fixing the issue and continue like:
    
    <verbatim>
    fconfigure $rf -encoding binary
    fcopy $rf $wf
    </verbatim>
    
       *   On write encoding errors, the data before the write error is written. The data causing the error and eventual following data is lost.
    
    Is there a way, that a script may make the difference between read and write encoding error?
    Both will throw "EILSEQ" error and have the same error message.
    
    Thank you and take care,
    Harald
    
  2. login: "oehhar"
  3. mimetype: "text/x-fossil-wiki"
  4. username: "oehhar"