Skip to content
Tcl Source Code History Of Ticket 407b70361c
Login

History Of Ticket 407b70361c

Artifacts Associated With Ticket 407b70361c

  1. Ticket change [701b2d2e57] (rid 216691) by dgp on 2023-07-24 14:26:54:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. comment initialized to:
      On a CentOS 7.9 system there are new test failures on the tip of 8.6 branch:
      
      ==== exec-9.1 commands returning errors FAILED
      ==== Contents of test case:
      
          set x [catch {exec gorp456} msg]
          list $x [string tolower $msg] [string tolower $errorCode]
      
      ---- Result was:
      1 {child process exited abnormally} {childstatus 30357 127}
      ---- Result should have been (exact matching):
      1 {couldn't execute "gorp456": no such file or directory} {posix enoent {no such file or directory}}
      ==== exec-9.1 FAILED
      
      
      
      ==== exec-9.2 commands returning errors FAILED
      ==== Contents of test case:
      
          string tolower [list [catch {exec [interpreter] echo foo | foo123} msg] $msg $errorCode]
      
      ---- Result was:
      1 {error writing "stdout": broken pipe
          while executing
      "puts {}"
          (file "echo" line 6)} {childstatus 30359 127}
      ---- Result should have been (exact matching):
      1 {couldn't execute "foo123": no such file or directory} {posix enoent {no such file or directory}}
      ==== exec-9.2 FAILED
      
      
      
      ==== exec-9.5 commands returning errors FAILED
      ==== Contents of test case:
      
          exec gorp456 | [interpreter] echo a b c
      
      ---- Result was:
      a b c
      child process exited abnormally
      ---- Result should have been (exact matching):
      couldn't execute "gorp456": no such file or directory
      ==== exec-9.5 FAILED
      
      
      
      ==== exec-13.3 setting errorCode variable FAILED
      ==== Contents of test case:
      
          set x [catch {exec _weird_cmd_} msg]
          list $x [string tolower $msg] [lindex $errorCode 0]  [string tolower [lrange $errorCode 2 end]]
      
      ---- Result was:
      1 {child process exited abnormally} CHILDSTATUS 127
      ---- Result should have been (exact matching):
      1 {couldn't execute "_weird_cmd_": no such file or directory} POSIX {{no such file or directory}}
      ==== exec-13.3 FAILED
      
      
      
      ==== exec-14.4 -- switch FAILED
      ==== Contents of test case:
      
          exec -- -gorp
      
      ---- Result was:
      child process exited abnormally
      ---- Result should have been (exact matching):
      couldn't execute "-gorp": no such file or directory
      ==== exec-14.4 FAILED
      
      
      
      ==== exec-17.1 inheriting standard I/O FAILED
      ==== Contents of test case:
      
          catch {exec [interpreter] $path(script)} result
          list $result [readfile $path(gorp.file)]
      
      ---- Result was:
      {} {}
      ---- Result should have been (exact matching):
      {} foobar
      ==== exec-17.1 FAILED
      
      
      ==== iocmd-11.4 I/O to command pipelines FAILED
      ==== Contents of test case:
      
          list [catch {open "| no_such_command_exists" rb} msg] $msg $::errorCode
      
      ---- Result was:
      0 file3 {TCL OPERATION EXEC BADREDIRECT}
      ---- Result should have been (exact matching):
      1 {couldn't execute "no_such_command_exists": no such file or directory} {POSIX ENOENT {no such file or directory}}
      ==== iocmd-11.4 FAILED
      
    5. foundin initialized to: "core-8-6-branch"
    6. is_private initialized to: "0"
    7. login: "dgp"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "8e2300e85be5dd1445b9666eb9429055951e33be"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "dgp"
    14. subsystem initialized to: "25. Channel System"
    15. title initialized to: "New test failures. Maybe unix pipe troubles?"
    16. type initialized to: "Bug"
  2. Ticket change [4d439b47a3] (rid 216700) by jan.nijtmans on 2023-07-24 15:16:37:

    1. icomment:
      Thanks! I disabled the usage of posix_spawnp now, until this is sorted out.
      
      Ideas welcome!
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [c5c21efcb1] (rid 216702) by dgp on 2023-07-24 15:25:06:

    1. icomment:
      
      
      Back to clean `make test-tcl` again on the branch tip.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. resolution changed to: "Fixed"
    5. status changed to: "Pending"
  4. Ticket change [16d2a048af] (rid 216709) by gustafn3 on 2023-07-24 17:31:46:

    1. icomment:
      I can confirm the problem. It looks to me like a bug in the version of libc that is used in CentOS 7. The spawn call on CentOS returns a valid PID and a status code of 0, indicating success, while on other systems, the proper error code is returned.
      
      CentOS 7 ships with GNU libc 2.17, which was released 2012-12-25 (more than 10 years old). For example, Ubuntu 20.04 (not a forefront version, either) ships with GLIBC 2.31. The changelog of GNU libc shows various fixes for posix_spawn after 2.17.
      
      I will add a fix to the posix-spawn branch this evening or tomorrow.
      
    2. login: "gustafn3"
    3. mimetype: "text/plain"
  5. Ticket change [86e561e7cf] (rid 216710) by gustafn3 on 2023-07-24 18:17:33:

    1. icomment:
      When I try to commit the patch to the original posix_spawn branch, fossil tells me, that I "cannot commit against a closed leaf". What is the right policy in such cases? Create a new branch for this ticket?
      
    2. login: "gustafn3"
    3. mimetype: "text/plain"
  6. Ticket change [94ce84934f] (rid 216711) by jan.nijtmans on 2023-07-24 20:38:35:

    1. icomment:
      I created the "bug-c54e4a1aeb" for doing experiments on this problem, so feel free to commit it there. But any other (new) branch is OK too.
      
      The orginal posix_spawn branch is already merged to core-8-6-branch, that's why it's closed
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [81c814ac97] (rid 216712) by chw on 2023-07-24 21:08:12:

    1. icomment:
      I believe it was fixed in GLIBC 2.24 and later, see work around in
      
        https://www.androwish.org/home/info/a0fe363cc68e5e24
      
    2. login: "chw"
    3. mimetype: "text/x-fossil-plain"
  8. Ticket change [f73965a624] (rid 216725) by gustafn3 on 2023-07-25 09:38:40:

    1. icomment:
      The patch in this branch (bug-c54e4a1aeb) fixes the problem and was 
      tested with CentOS 7.9 and also with macOS 13.4, Ubuntu 20.04, 
      and OpenBSD 7.2. 
      
      The patch uses vfork(), which has in essence the same memory 
      characteristics but has broader support (just deprecated under 
      macOS, where it will not be used). If there is interest, I can 
      collect the performance characteristics for Linux similar to 
      https://core.tcl-lang.org/tcl/tktview/c54e4a1aeb
      
    2. login: "gustafn3"
    3. mimetype: "text/plain"
  9. Ticket change [b8c152a35f] (rid 216742) by jan.nijtmans on 2023-07-26 07:17:28:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2460151.80379703"
    3. closer changed to: "jan.nijtmans"
    4. login: "jan.nijtmans"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
  10. Ticket change [08ed9b0ea0] (rid 226329) by chw on 2024-05-21 15:00:43:

    1. closedate changed to: "2460452.12550179"
    2. closer changed to: "chw"
    3. icomment:
      I've observed exec-17.1 failing on Debian 9 exactly as in the
      ticket's description. My remedy was to mimic the FD_CLOEXEC
      semantics as close as possible before the posix_spawnp() and
      cleaning up right after, see
      
        https://www.androwish.org/home/info/929b393ec4e7f0a4
      
      for a patch.
      
    4. login: "chw"
    5. mimetype: "text/x-fossil-plain"
  11. Ticket change [d4e5a3d94c] (rid 226402) by oehhar on 2024-05-22 06:33:45:

    1. closedate changed to: "2460452.77344435"
    2. closer changed to: "oehhar"
    3. icomment:
      Hi magic Christian!
      Thanks for the patch, I appreciate.
      I will try to find a wizard able to handle it.
      
      Take care,
      Harald
      
    4. login: "oehhar"
    5. mimetype: "text/x-fossil-wiki"
    6. username: "oehhar"
  12. Ticket change [af9e0ba784] (rid 226432) by jan.nijtmans on 2024-05-22 11:38:03:

    1. closedate changed to: "2460452.98476215"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      Christian's proposal committed to a [039305c27426e7ed|branch]
      
      However, I'm not convinced this is still needed. This ticket is already closed (with help from Gustaf Neumann), by switching from fork to posix_spawnp.
      
      Christian, did you observe exec-17.1 failing in androwish or in Tcl 8.6? That's quite a difference ..... Androwish didn't take over all changes from Tcl 8.6.
      
      So, for now, keeping closed ;-)
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
  13. Ticket change [82233f7175] (rid 226435) by chw on 2024-05-22 14:14:20:

    1. closedate changed to: "2460453.09329715"
    2. closer changed to: "chw"
    3. icomment:
      Let me explain what the change is for in regard to exec-17.1:
      The test constructs a scenario where
      
       posix_spawn_file_actions_adddup2(&actions, 1, 1)
      
      is set where the file descriptor 1 has the FD_CLOEXEC set due
      to stdout being closed and a plain file opened. When this
      call does nothing or fails (since we're dup'ing 1 to 1)
      the exec does not get passed file descriptor 1 anymore
      (remember FD_CLOEXEC still set) and the test fails.
      
      Are there any guarantees in p_s_f_a_a() regarding this case?
      I think not, and this potentially varies between C lib versions.
      So it is not a bad idea to catch these special cases for the
      file descriptors 0, 1, and 2.
      
      BTW: I observed it in my AndroWish branch on Debian 9 which
      is quite old indeed. Did the patch break things in different
      ways on other (newer) systems?
      
    4. login: "chw"
    5. mimetype: "text/x-fossil-plain"
  14. Ticket change [13a9e117f9] (rid 226441) by gustafn3 on 2024-05-22 17:24:26:

    1. closedate changed to: "2460453.22530516"
    2. closer changed to: "gustafn3"
    3. icomment:
      Debian 9 is quite old (initially released on June 17th, 2017, 
      security updates have been discontinued as of July 6th, 2020).
      
      The implementation of TclpCreateProcess() uses now vfork() on most systems 
      (recent Linux versions, macOS). Part of the "fix" of the problem was to make
      sure, that configure picks up the "USE_VFORK" preprocessor flag. 
      Isn't this also an option for AndroWish?
      
      I do not think that the fix of chw breaks other systems, but I am not fully
      convinced, that it helps as it is under all conditions (dirty reads?)
      
    4. login: "gustafn3"
    5. mimetype: "text/plain"
  15. Ticket change [ce8f76d61d] (rid 226445) by chw on 2024-05-22 20:28:12:

    1. closedate changed to: "2460453.35291787"
    2. closer changed to: "chw"
    3. icomment:
      Gustaf,
      
      yep, Debian 9 is dead. But I still insist on the semantic of
      
      posix_spawn_file_actions_adddup2(&actions, 1, 1)
      
      If it does not really dup, then the FD_CLOEXEC is not cleared.
      Since dup() seems to do this by POSIX definition (but see below).
      
      If you analyze the olden forkery, the trick is that the child
      before exec fixes the three nasty 0/1/2 file descriptors 
      to be not FD_CLOEXEC.
      
      And then there's specially hackery for the ultra dead Ultrix
      in SetupStdFile(). Since Ultrix does not clear FD_CLOEXEC on
      the dup'ed fd (see above).
      
      IMO too much variables and no certainty and no proper definition
      of p_s_f_a_a in POSIX so better make things safe.
      
      If you don't like that patch, no problem, I will live with it.
      
    4. login: "chw"
    5. mimetype: "text/x-fossil-plain"