Hello Samuel,

On Sun, Dec 23, 2024 at 05:38:14PM +0100, Samuel Thibault wrote:
> From reading hurd/trans/fifo.c's close_hook, it looks like it was
> deliberate to make a last-writer closure make the whole pipe disappear.
> 
>     /* See if PIPE should cease to be the user-visible face of this fifo.  */
>     detach =
>       ((flags & O_READ) && pipe->readers == 1)
>        || ((flags & O_WRITE) && pipe->writers == 1);
> 
> But the comment of the commit (a184f3a4f1a4ffd3191ad34579af9bf4d39abb20)
> is different:
> 
>     (close_hook):
>       Also disconnect ACTIVE_FIFO if the laster writer is going away and there
>         were no readers.
> 
> but the code above does not actually check against there being no
> readers any more.
> 
> There being no reader any more would have been caught by the original
> code already:
> 
>        /* We're the last reader; when we're gone there is no more joy.  */
>        detach = ((flags & O_READ) && pipe->readers == 1);
> 
> So probably that line could be restored as it was and just let the rest
> as it is currently: in open_hook we properly make an incoming writer
> either wait for a reader or immediately return ENXIO if here is none and
> O_NDELAY was given.
> 
> Could you try to do the change and check that it fixes your issue?

Ok, I tried the modified fifo and now it works!
I tried this on a somewhat ropey installation of 2023 release snapshot (procfs
crashing all the time), but hopefully things have not changed since in this
regard.

I also tried to copy new-fifo as fifo and things seemed to work as well.

I guess this bug could be closed once a patched hurd is uploaded?

Many thanks for your work!
João

Reply via email to