Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] zsh_eval_context: add math context



> 2026/05/24 5:45、dana <dana@xxxxxxx>のメール:

> diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst

> @@ -1649,11 +1649,96 @@
(snip)
> +   cat =( contextfn )
> +   : >( contextfn )
> +   : > >( contextfn )

[1] On FreeBSD and Dragonfly, D04parameter.ztst hangs at
    : >( contextfn )

A possible patch is at the end of this post.

[2] Why it hangs?
On these systems process substitution uses FIFO (not /dev/fd):

    % echo >(true)
    /tmp/zshWdUcQr
    (hangs; I need to type ctrl-C)

The subshell is blocked at exec.c:5116:
    fd = open(pnam, out ? O_WRONLY | O_NOCTTY : O_RDONLY | O_NOCTTY);
('out' if false here)

It seems open() blocks until the other end (writer) of FIFO also open() it.

[3] bash on FreeBSD also uses FIFO for the process substitution, but
it does not hang for

    bash$ echo >(true)
    /tmp//sh-np.nj3bkI
    bash$

I don't know how bash achieves this.

[4] For the test of $zsh_eval_context the following would be enough:


diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 97577fd4e..f734f9615 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1679,7 +1679,7 @@
    cat <( contextfn )
    cat < <( contextfn )
    cat =( contextfn )
-   : >( contextfn )
+   () { echo > $1 } >( contextfn )
    : > >( contextfn )
    source <( <<< contextfn )
    $ZTST_testdir/../Src/zsh -fc 'print -r - $zsh_eval_context'






Messages sorted by: Reverse Date, Date, Thread, Author