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

Re: [PATCH] zsh_eval_context: add math context



> 2026/06/21 10:03、dana <dana@xxxxxxx>のメール:
> 
> On Thu 18 Jun 2026, at 14:47, Jun T wrote:
>> [1] On FreeBSD and Dragonfly, D04parameter.ztst hangs at
>>    : >( contextfn )
> 
> sorry about that. i suppose it's similar to `: $( cat )` so it makes
> sense? not sure why it's different on freebsd specifically though

On most systems (Linux etc.) process substitution uses /dev/fd, but on
FreeBSD and Dragonfly FIFO is used. POSIX requires that open(FIFO) for
reading (or writing) should block until the other end opens the FIFO
for writing (or reading), unless the O_NONBLOCK flag is set. 

> On Thu 18 Jun 2026, at 14:47, Jun T wrote:
>> -   : >( contextfn )
>> +   () { echo > $1 } >( contextfn )
> 
> wouldn't `: > >( contextfn )` be sufficient?

': >( cmd )' and '() { echo > $1 } >( cmd )' are handled by getproc()
but ': > >( cmd )' is handled by getpipe() (both are in exec.c).
I thought you wanted to test both cases.

> it doesn't matter much
> either way but i can imagine someone looking at it again in the future
> wondering if the anon function is significant to the test case

Maybe we can add some comments like this:


diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index d6e0044ef..16d98fbec 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -1718,7 +1718,8 @@
    cat <( contextfn )
    cat < <( contextfn )
    cat =( contextfn )
-   : >( contextfn )
+   # ': >( contextfn )' would hang if FIFO is used for process substitution
+   () { echo > $1 } >( contextfn )
    : > >( contextfn )
    source <( <<< contextfn )
    $ZTST_testdir/../Src/zsh -fc 'print -r - $zsh_eval_context'

--
Jun





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