Skip to content
Tcl Source Code History Of Ticket 8419c55e2cb159f9
Login

History Of Ticket 8419c55e2cb159f9

Artifacts Associated With Ticket 8419c55e2cb159f9

  1. Ticket change [c8899efe6d] (rid 192136) by anonymous on 2021-02-27 04:08:26:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      I'm building an extension to a large and rather opaque Linux package
      (About which I won't say more).  One of the things I knew from the
      documentation, but which I had not thought about is that the package
      uses timers and SIGALRM handling internally to do its house keeping
      and maintain its state.  I saw the warning to not use SIGALRM in
      any calling program, but since I wasn't doing that, and was pretty
      sure Tcl wasn't doing that, I wasn't worried.
      
      And in fact, things work pretty well as long as I am running my
      tests from scripts.  I noticed however, that if I had the package
      loaded in an interactive Tclsh so I could type things at it, Tclsh
      would often unexpectedly & silently exit. I finally figured out
      this must be whenever a SIGLARM fires and the package calls its
      handler function.
      
      Looking at the code in tclUnixChan.c where the Tclsh terminal read
      loop reads are done, I see that EINTR is not handled, even though
      it is handled for pipes and sockets elsewhere.
      
      If I make the following change, based on the code used for pipes
      and sockets,  and compile a new Tclsh, it works fine.  This seems
      like a bug to me -- is there some reason for not handling EINTR
      here?
      
      
      % diff -c tclUnixChan.c.bak tclUnixChan.c
      *** tclUnixChan.c.bak   Fri Feb 12 13:59:13 2021
      --- tclUnixChan.c       Fri Feb 12 13:59:13 2021
      ***************
      *** 253,259 ****
             * nonblocking, the read will never block.
             */
        
      !     bytesRead = read(fsPtr->fd, buf, (size_t) toRead);
            if (bytesRead > -1) {
              return bytesRead;
            }
      --- 253,262 ----
             * nonblocking, the read will never block.
             */
        
      !     do {
      !       bytesRead = read(fsPtr->fd, buf, (size_t) toRead);
      !     } while ((bytesRead < 0) && (errno == EINTR));
      ! 
            if (bytesRead > -1) {
              return bytesRead;
            }
      
    5. foundin initialized to: "8.6.*"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "f453a2d8b2491bec888a11ddd709eccbaa04b032"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "55. Other Tools"
    15. title initialized to: "Tclsh read loop does not handle EINTR"
    16. type initialized to: "Bug"
  2. Ticket change [73c9a8e3b7] (rid 192309) by jan.nijtmans on 2021-03-09 08:59:44:

    1. assignee changed to: "jan.nijtmans"
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  3. Ticket change [a1a2f536cf] (rid 192316) by jan.nijtmans on 2021-03-09 09:23:11:

    1. closedate changed to: "2459282.89110377"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Thanks for your report, your analysis and the fix. Fully 100% OK!
      
      Fixed now in all active branches. Thanks!
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
  4. Ticket change [98db484630] (rid 195311) by chw on 2021-08-09 21:33:32:

    1. closedate changed to: "2459436.39828874"
    2. closer changed to: "chw"
    3. icomment:
      IMO the fix in tclUnixChan.c due to the bug report is too invasive, since it
      changes the entire channel behaviour on EINTR fundamentally w.r.t. earlier
      Tcl versions. The bug report mentions only the REPL of tclMain.c having a
      problem, thus a less invasive measure against signals would be to only change
      the REPL regarding EINTR, as can be seen in this check-in on www.androwish.org:
      
        https://www.androwish.org/home/info/0c961bcefd7ca47c
      
    4. login: "chw"
    5. mimetype: "text/plain"