Skip to content
Tcl Source Code History Of Ticket 813087ffffffffff
Login

History Of Ticket 813087ffffffffff

Artifacts Associated With Ticket 813087ffffffffff

  1. Ticket change [d6638170b7] (rid 123797) by dmacks on 2003-09-26 14:12:13:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      tcltk-8.4.1 compiled from the unix/ directory on OS X
      10.2.6.
      tcltk-8.3.4 that comes precompiled with my OS X is not
      affected.
      
      When tclsh is used in a pipeline, stdout is treated
      like a socket. This is bad because it defaults to CR/LF
      line endings, not the LF that is expected and
      appropriate for a Unix platform when parsing piped
      commands. Simple Unix file descriptor redirection does
      not have this problem.
      
      Here are three examples that look correct:
      
      % tclsh
      % fconfigure stdout
      -blocking 1 -buffering line -buffersize 4096 -encoding
      utf-8 -eofchar {} -translation crlf -mode 9600,n,8,1
      -xchar {p r}
      [that {p r} is actually untypable characters)
      
      % echo "puts [fconfigure stdout]" | tclsh
      -blocking 1 -buffering line -buffersize 4096 -encoding
      utf-8 -eofchar {} -translation crlf -mode 9600,n,8,1
      -xchar {p r}
      
      % echo "puts [fconfigure stdout]" | tclsh > foo ; cat
      -vte foo
      -blocking 1 -buffering line -buffersize 4096 -encoding
      utf-8 -eofchar {} -translation lf$
      
      So simple output and redirected output and piped input
      are okay, but if output is piped:
      
      % echo "puts [fconfigure stdout]" | tclsh | cat -vte 
      -blocking 1 -buffering line -buffersize 4096 -encoding
      utf-8 -eofchar {{} {}} -translation {auto crlf}
      -peername {0.0.0.0 0.0.0.0 0} -sockname {0.0.0.0
      0.0.0.0 0}^M$
      
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "dmacks"
    9. subsystem initialized to: "27. Channel Types"
    10. title initialized to: "tclsh treats Unix pipelines as sockets"
    11. type initialized to: "Bug"
  2. Ticket change [356f679d16] (rid 106930) by cc_benny on 2003-09-26 21:58:47:

    1. icomment:
      Logged In: YES 
      user_id=143885
      
      Preliminary points of analysis:
      
      - getsockopt() is called in tclUnixChan.c:Tcl_MakeFileChannel()
      to determine if a file handle is a socket.  For anonymous pipes
      this returns -1/ENOTSOCK on Linux as expected, but on Mac OS
      X (10.3.6) it returns 0, so the pipe is handled as a socket.
      
      - This happens in 8.4.4. In 8.3.4 getsockopt() is not called
      at all according to ktrace/strace. I haven't investigated the
      8.3 source yet, where the actual difference are here.
      
      
      
    2. login: "cc_benny"
    3. mimetype: "text/plain"
    4. username: "cc_benny"
  3. Ticket change [d38dc3a95a] (rid 123309) by cc_benny on 2003-09-27 22:50:17:

    1. icomment:
      Logged In: YES 
      user_id=143885
      
      More points:
      
      - Darwin/Mac OS X implements pipes as sockets internally. This
      is also on NetBSD.
      
      - The call to getsockopt() was added to
      tclUnixChan.c:Tcl_MakeFileChannel() in version 1.20 of the
      file by
      dkf (Donal K. Fellows) in response to bug #219137.
      
      See posting on a NetBSD list
      <http://groups.google.com/groups?selm=20010327154747.A13991%40vaasje.org>
      for alternative code to detect socket vs. other file types,
      based on getsockname().  That code works here on Mac OS
      X and could be used in Tcl_MakeFileChannel() instead of (or in
      addition to) getsockopt(SO_TYPE).
      
      
      
    2. login: "cc_benny"
    3. mimetype: "text/plain"
    4. username: "cc_benny"
  4. Ticket change [a6f3573900] (rid 98698) by cc_benny on 2003-09-27 23:31:47:

    1. icomment:
      Logged In: YES 
      user_id=143885
      
      See patch #813606.
      
      
    2. login: "cc_benny"
    3. mimetype: "text/plain"
    4. username: "cc_benny"
  5. Ticket change [251d442528] (rid 131229) by jenglish on 2003-10-03 07:35:02:

    1. icomment:
      Logged In: YES 
      user_id=68433
      
      From the patch:
      !     if (getsockname(fd, (struct sockaddr *)&sockaddr,
      &sockaddrLen) == 0
      !             && sockaddrLen > 0
      !             && sockaddr.ss_family != AF_UNSPEC
      !             && sockaddr.ss_family != AF_LOCAL) {
      !         return MakeTcpClientChannelMode((ClientData) fd,
      mode);
      
      A better test would be:
      
      if (sockaddrLen > 0 && sockaddr.ss_family == AF_INET) { ...
      }
      
      
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  6. Ticket change [7a41b5cb8d] (rid 90280) by cc_benny on 2003-10-03 20:37:28:

    1. icomment:
      Logged In: YES 
      user_id=143885
      
      >if (sockaddrLen > 0 && sockaddr.ss_family == AF_INET)
      
      Don't forgot the call to getsockname().
      
      AF_INET limits this function to IP.  But the rest of the code
      is limited to IP anyway, so you are right.
      
      
      
    2. login: "cc_benny"
    3. mimetype: "text/plain"
    4. username: "cc_benny"
  7. Ticket change [d58b6361af] (rid 123642) by andreas_kupries on 2003-10-24 01:03:19:

    1. closedate changed to: "2003-10-23T18:03:19"
    2. closer changed to: "andreas_kupries"
    3. icomment:
      Logged In: YES 
      user_id=75003
      
      The referenced patch was accepted with small changes (see 
      patch page) and committed to both head and core-8-4-
      branch. This fixes the bug.
      
      
      
    4. login: "andreas_kupries"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "andreas_kupries"