Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ec487dc1a09fc5d8adea5062230e33a4dd3bccbd58923e8dd230e99d69a8c486
Ticket: 7b4a819535231639cccf59d197ed59ded4375119
Sometimes, on macOS, 15/20 minutes are not enough to run all testcases
User & Date: sl1200mk2 on 2026-09-14 14:41:54
Changes

  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"