Skip to content
Tcl Source Code History Of Ticket 7b4a819535
Login

History Of Ticket 7b4a819535

Artifacts Associated With Ticket 7b4a819535

  1. Ticket change [e51b217c5c] (rid 256218) by sebres on 2026-09-11 15:05:30:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      Attempts to fix (like [34db3351f1d7faf1]) would not help at all, because it is not slowness but [https://github.com/tcltk/tcl/actions/runs/34596018024/job/103251831007#step:5:119209|hang]:
      
      <code><pre style="margin-left:15pt">
      2026-09-11T11:58:45.9965230Z unixFCmd.test
      2026-09-11T11:58:46.0526710Z ---- unixFCmd-1.1 start
      2026-09-11T11:58:46.0538050Z ++++ unixFCmd-1.1 took 1 ms
      ...
      2026-09-11T11:58:46.0595970Z ---- unixFCmd-2.3 start
      2026-09-11T11:58:46.0596640Z ++++ unixFCmd-2.3 took 0 ms
      2026-09-11T11:58:46.0599030Z ---- unixFCmd-2.4 start
      2026-09-11T12:23:14.7589210Z ##[error]The action 'Run Tests' has timed out after 30 minutes.
      </pre></code>
      
      Something seems to be wrong in unixFCmd-2.4 (or rather with file copy) - looks like a race condition to me.
      
      Also the AIs are in agreement here:
      <i>
      On macOS, opening a FIFO for reading (without the O_NONBLOCK flag) blocks until another process opens the same FIFO for writing. This behavior is documented in the open(2) man page and is specific to the BSD-based kernel that macOS uses. On Linux, the same operation returns immediately, which is why the test may pass on other Unix-like systems but hangs on macOS.
      </i>
      
      The [./file?ci=core-8-6-branch&name=unix%2FtclUnixFCmd.c&ln=519-523|check for S_IFIFO] in DoCopyFile whether the source is fifo seems to be not enough there (or there is some bypass somewhere for MACOS and it fallsback to copy), or [e4d3a903de130788] misses something yet specific for macos.<br/>
      I could try to fix it, but I don't have macos to hand and debugging and fixing sporadic heisenbug on GH is thankless task.
      
    5. foundin initialized to: "any"
    6. is_private initialized to: "0"
    7. login: "sebres"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "50e9528765c18296566374b3fde2df942c394efd"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "sebres"
    14. subsystem initialized to: "16. Commands A-H"
    15. title initialized to:
      Sometimes, on macOS, 15/20 minutes are not enough to run all testcases
      
    16. type initialized to: "Bug"
  2. Ticket change [42ea357b90] (rid 256222) by sebres on 2026-09-11 15:10:33:

    1. icomment:
      Therefore, the test for macOS is being disabled in [b7d236402fcec914] for 8.6+ for now, until the issue is resolved.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [38c4615cc9] (rid 256230) by jan.nijtmans on 2026-09-11 18:18:18:

    1. icomment:
      Thank you for having a look at this. I already figured, it was some kind of a hang, more complicated than a simple timeout.
      
      So, fully agreed! +1
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  4. Ticket change [d87b267463] (rid 256292) by jan.nijtmans on 2026-09-14 07:58:40:

    1. icomment: "Still hanging :-("
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [df05fd82ee] (rid 256295) by sebres on 2026-09-14 11:19:05:

    1. icomment:
      Hmm, looks like it were [https://github.com/tcltk/tcl/actions/runs/34835294458/job/103947631617|different now] for all 3 builds (xcode & 2 clang):
      <code><pre style="margin-left:15pt">
      2026-09-14T10:59:24.2315740Z tcltest.test
      ...
      2026-09-14T10:59:24.2316790Z ---- tcltest-4.1 start
      2026-09-14T11:08:53.1772100Z ##[error]The action 'Run Tests' has timed out after 15 minutes.
      -------------------------
      2026-09-14T10:58:07.3118320Z tcltest.test
      ...
      2026-09-14T10:58:07.3143360Z ---- tcltest-21.5 start
      2026-09-14T11:13:16.6458290Z ##[error]The operation was canceled.
      2026-09-14T11:13:16.6658760Z Post job cleanup.
      -------------------------
      2026-09-14T11:00:21.4613910Z tailcall.test
      ...
      2026-09-14T11:00:21.4617130Z ---- tailcall-7 start
      2026-09-14T11:13:04.2408000Z ##[error]The action 'Run Tests' has timed out after 20 minutes.
      </pre></code>
      
      Something is completely wrong on macos side. Do we have people with mac to hand?
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  6. Ticket change [3ac758ef18] (rid 256297) by sebres on 2026-09-14 11:29:29:

    1. icomment:
      Huh, and test tcltest-4.1 has a constraint {unixOrWin}, how the test can trigger run for it on macos? Weird.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [83d4129124] (rid 256299) by sebres on 2026-09-14 13:10:20:

    1. icomment:
      OK, looks like it doesn't detect mac at all, because tcl_platform(platform) is recognized as "unix".
      
      See [https://github.com/tcltk/tcl/actions/runs/34846833228/job/103984729723#step:5:14|runs/34846833228/job/103984729723#step:5:14] :
      <code><pre>
      **** osVersion 24.6.0 pointerSize 8 byteOrder littleEndian machine arm64 platform unix pathSeparator : os Darwin engine Tcl user runner wordSize 8 ****
      **** unix ****
      **** unixOrWin: 1, unix: 1, win: 0. mac: 0 ****
      </pre></code>
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  8. Ticket change [da39fe9edd] (rid 256300) by anonymous on 2026-09-14 13:36:52:

    1. icomment:
      Hi, 
      I've a macOS and i can do some tests if you want
      
      nicolas
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
  9. Ticket change [2912ac7063] (rid 256301) by sebres on 2026-09-14 14:07:37:

    1. icomment:
      I don't know how it ever working properly, because $::tcl_platform(platform) is basically never "macintosh" (I didn't search for the revision yet, but even 8.5/8.6 seem to miss it (it is either dos, unix or windows, nothing else).
      
      The fix (repairing tcltest) may look like this - [https://github.com/tcltk/tcl/commit/956856ba192179526fc12241f1bcb4ee1a540924|GH/tcl/956856ba192179526fc12241f1bcb4ee1a540924]:
      <code><pre style="margin-left:15pt">
          ConstraintInitializer unixOnly \
      -	    {string equal $::tcl_platform(platform) unix}
      +	    {expr {$::tcl_platform(platform) eq "unix" && $::tcl_platform(os) ne "Darwin"}}
          ConstraintInitializer macOnly \
      -	    {string equal $::tcl_platform(platform) macintosh}
      +	    {expr {$::tcl_platform(platform) eq "unix" && $::tcl_platform(os) eq "Darwin"}}
          ConstraintInitializer pcOnly \
      	    {string equal $::tcl_platform(platform) windows}
          ConstraintInitializer winOnly \
      </pre></code>
      As you can see - [https://github.com/tcltk/tcl/actions/runs/34849913792|runs/34849913792] - it fixed the hang, but...
      
      An alternative fix may move this logic to TclpSetVariables(), and restore $::tcl_platform(platform) "macintosh" back. 
      However it looks as too grave change to my taste.
      
      I'm not really familiar with macos, so I'd like to delegate this decision to someone else. I'd firstly repair macos in tcltest only, but there are more places in source code checking for "macintosh".
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  10. Ticket change [ec487dc1a0] (rid 256307) by sl1200mk2 on 2026-09-14 14:41:54:

    1. icomment:
      here's what AI is saying about it:
      
      here (macOS 26.6.2, Apple M4 Pro). No platform decision is needed: the hang comes from `file copy` itself, fix below.
      
      **`mac` never matches on macOS, by design.** `macintosh` was Mac OS Classic, removed in 2004 [b6330dbac7]. Mac OS X has always been `unix` for Tcl, so the `mac*` constraints of tcltest are leftovers and `tempNotMac` is always 1 there. Returning "macintosh" again would break every script that relies on `unix`.
      
      **956856b only hides the hang.** It turns `unix` off on macOS: a full `make test` then runs 334 fewer tests (61966 instead of 62300), unixFCmd-2.4 among them, and Tk or extensions using tcltest would lose their `unix` tests too.
      
      **Cause.** unixFCmd-2.4 hangs every time here, on 8.6 and 9.0:
      
          DoCopyFile → CopyFileAtts → TclMacOSXCopyFileAttributes → copyfile → copyfile_set_dst_permissions → open
      
      After `mkfifo`, copyfile(3) opens the new fifo in blocking mode and waits forever for a writer. copyfile only handles regular files, directories and links (ENOTSUP otherwise), so skipping it loses nothing. `file copy` of a directory containing a named pipe hangs the same way. The hangs reported in tailcall-7, tcltest-4.1 and tcltest-21.5 come from `| grep` buffering: with that pipeline, the log here stops at trace-16.8 while the process is stuck in unixFCmd-2.4.
      
      **Fix** for 8.6, 9.0 and trunk: skip copyfile() for other file types, and remove `tempNotMac`. unixFCmd-2.4 passes on 8.6 and 9.0; on 9.0 the full `make test` with the CI settings gives 68144 tests, 0 failures, in 3 minutes.
      
      ```diff
      Index: macosx/tclMacOSXFCmd.c
      ==================================================================
      --- macosx/tclMacOSXFCmd.c
      +++ macosx/tclMacOSXFCmd.c
      @@ -395,10 +395,21 @@
           const char *src,		/* Path name of source file (native). */
           const char *dst,		/* Path name of target file (native). */
           const Tcl_StatBuf *statBufPtr)
       				/* Stat info for source file */
       {
      +    /*
      +     * copyfile() only handles regular files, directories and links (ENOTSUP
      +     * otherwise), but recent macOS versions first open() dst, which never
      +     * returns if dst is a fifo. [7b4a819535]
      +     */
      +
      +    if (!S_ISREG(statBufPtr->st_mode) && !S_ISDIR(statBufPtr->st_mode)
      +	    && !S_ISLNK(statBufPtr->st_mode)) {
      +	return TCL_OK;
      +    }
      +
           if (MayUseCopyFile()) {
       #ifdef HAVE_COPYFILE
       	if (0 == copyfile(src, dst, NULL, (S_ISLNK(statBufPtr->st_mode)
       		? COPYFILE_XATTR | COPYFILE_NOFOLLOW_SRC
       		: COPYFILE_XATTR | COPYFILE_ACL))) {
      
      Index: tests/unixFCmd.test
      ==================================================================
      --- tests/unixFCmd.test
      +++ tests/unixFCmd.test
      @@ -210,11 +210,11 @@
           }
           # file copy $null tf1
       } -result {}
       test unixFCmd-2.4 {TclpCopyFile: src is fifo} -setup {
           cleanup
      -} -constraints {unix notRoot execMknod tempNotMac} -body { # tempNotMac -- see bug [7b4a819535231639]
      +} -constraints {unix notRoot execMknod} -body {
           exec mknod tf1 p
           file copy tf1 tf2
           list [file type tf1] [file type tf2]
       } -cleanup {
           cleanup
      ```
      
    2. login: "sl1200mk2"
    3. mimetype: "text/x-markdown"
  11. Ticket change [ceecda979c] (rid 256309) by sebres on 2026-09-14 15:55:27:

    1. icomment:
      <i>> No platform decision is needed</i>
      
      Sure, as I wrote below it is temporary constraint to ignore test, till it is fixed properly.
      
      <i>> unixFCmd-2.4 passes on 8.6 and 9.0; on 9.0 the full `make test` with the CI settings gives 68144 tests, 0 failures, in 3 minutes.</i>
      
      Thx, I'll check it.
      
      But as you can see on [https://github.com/tcltk/tcl/actions|GH], more tests failing here and there (it is not unixFCmd-2.4 only), and they all are sporadic.
      The basic issue was a wrong constraints detection, repaired in [001fa14844a641c6] now. But you can try to fix another issues too.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  12. Ticket change [88e95e92cc] (rid 256319) by jan.nijtmans on 2026-09-14 19:01:27:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      Let's [f44aa91653bea8e8|try] sl1200mk2's proposed solution.
      
      I agree with Don that changing existing constraints in tcltest is not a good idea: Any testcase which was written for the old Macintosh will - after this change - suddenly start failing when run under MacOS. Therefore, in the above commit, I reverted the changes to tcltest.tcl. Also, because we now know that macintosh is not supported any more, let's just remove the tempNotMac restrictions (since this is always 1) and change macOrUnix to unixOnly.
      
      Tomorrow we will see if this works.
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
  13. Ticket change [0af6887993] (rid 256325) by sebres on 2026-09-14 20:09:49:

    1. icomment:
      As already said (see below), it failed sporadically here and there, and some of the tests where it was hanging have nothing to do with fifo-detection fix at all.
      
      I also committed the fix directly in GH (without changing the constraints back), but a bit simpler variant:
      
      <pre>
      +    /*
      +     * FIFOs do not have attributes, moreover calling copyfile() 
      +     * could cause a blocking deadlock in the macOS VFS layer,
      +     * see [7b4a819535231639].
      +     */
      +    if (S_ISFIFO(statBufPtr->st_mode)) {
      +        return TCL_OK;
      +    }
      </pre>
      
      Looks good now - [https://github.com/tcltk/tcl/actions/runs/34888741662|GH/runs/34888741662]. Thus I'd add it to 8.6/9.0 (just to see who wins tomorrow ;)...<br/>
      Let see if your branch would hang somewhere else.
      
      Regarding the constraints - partially agree, but as already said it'd be rather task for someone with macos. Anyway, we can revert them if your branch passes the tests (and remain stable in few days).
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  14. Ticket change [af33ecfefc] (rid 256335) by jan.nijtmans on 2026-09-15 07:04:20:

    1. icomment:
      So, what should happen with S_ISCHR/S_ISBLK/S_ISSOCK? Do they have attributes?
      
      Your S_ISFIFO solution is the 'least change in functionality' solution, which is safest, so let's go for that (whether it actually fixes _this_ hang or not).
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  15. Ticket change [c338b78c6b] (rid 256342) by jan.nijtmans on 2026-09-15 07:55:37:

    1. login: "jan.nijtmans"
    2. mimetype: "text/plain"
    3. resolution changed to: "Fixed"
    4. status changed to: "Pending"
  16. Ticket change [96481701fa] (rid 256343) by sebres on 2026-09-15 11:19:31:

    1. closedate changed to: "2461298.9718971294"
    2. closer changed to: "sebres"
    3. icomment:
      I don't think S_ISCHR, S_ISBLK, or S_ISSOCK will ever hang on Darwin's copyfile() function in the same way S_ISFIFO does. However they are also special file types, their underlying VFS structures handle read/write stream initialization differently. Also AIs seem to confirm that.
      
      Although I wonder about another tests that was hanging previously... I don't believe there were a copy of PIPE attrs somewhere (stdout?). But lets see whether it'd hang later.
      
      Closed now.
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"
    6. status changed to: "Closed"