coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tail: --pid option does not work when input is a FIFO


From: Pádraig Brady
Subject: Re: tail: --pid option does not work when input is a FIFO
Date: Tue, 7 Jan 2025 15:08:26 +0000
User-agent: Mozilla Thunderbird Beta

On 19/10/2024 08:48, Bernhard Voelker wrote:
Hi Padraig,

On 10/18/24 14:50, Pádraig Brady wrote:
In my testing the initial open() of the fifo blocks,
before the -f loops are processed.
If the monitored file was written by another process,
this_does_  unblock things for me, and --pid is processed.

The attached patch avoids the blocking behavior with fifos,
and thus honors the --pid checking in parallel (and passes all tests).

Thanks, this solves the issue for my case:

    $ rm f; mkfifo f ; sleep 5 & timeout 10 ~/coreutils/src/tail -f --pid=$! f; 
echo $?
    [3] 1174778
    [3]+  Done                    sleep 5
    0

However I've only thought about this for a couple of minutes,
so need to consider all the implications.

I didn't have the time to check further either.

I'll push the attached later,
which is a little more conservative
in that it only opens with O_NONBLOCK if possibly needed.

cheers,
Pádraog

Attachment: tail-pid-fifo.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]