Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ce43673d3cf2d514c9af573b052a0a2d59de64a3
Ticket: 415131ffffffffffffffffffffffffffffffffff
multithreaded tclsh exec fails (FreeBSD)
User & Date: mad_derf on 2001-04-10 12:38:11
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Hi all,
    
    I have been trying to use the tclsh8.1_r on a FreeBSD
    host (it was the only available precompiled package,
    but I also had the case with Tcl 8.0 and Tcl 8.3.2
    compiled).
    
    Ok, so here is the problem :
    
    % exec ls
    error reading output from command: interrupted system
    call
    %
    
    When I link tclsh with libc.so rather than libc_r.so
    (the multi-threaded c library), there is no problem,
    but if I link with the libc_r.so, I often have the
    above output (I say often, because it also sometimes
    work ...)
    
    I went into the code (and I had to say it was tough
    with GDB - seems to have problem with multi-threaded
    applications on FreeBSD), and it seems to be coming
    from the unix/tclUnixPipe.c file.
    
    In the PipeInputProc (), I replaced :
    
    ------------
    
        bytesRead = read(GetFd(psPtr->inFile), buf,
    (size_t) toRead);
        if (bytesRead > -1) {
            return bytesRead;
        }
        *errorCodePtr = errno;
        return -1;
    
    ------------
    
    with
    
    ------------
    
        do
    {
    bytesRead = read(GetFd(psPtr->inFile), buf, (size_t)
    toRead);
    } while ((bytesRead < 0) && (errno == EINTR));
    
        if (bytesRead < 0)
    {
    *errorCodePtr = errno;
    return (-1);
    }
        else
    {
    return (bytesRead);
    }
    -------------
    
    It seems that the SUN RPCs also use that trick (in
    clnt_udp.c). After applying that patch, it seems all
    right.
    
    Shall I commit somewhere for that patch to be
    integrated (if agreed) in next releases ?
    
    Hope this helps
    
    DERF
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "mad_derf"
  9. subsystem changed to: "49. Threading"
  10. title changed to: "multithreaded tclsh exec fails (FreeBSD)"
  11. type changed to: "Bug"