notmuch vs. SIGPIPE

Subject: notmuch vs. SIGPIPE

Date: Mon, 20 Jan 2020 12:55:28 +0100



From: Thomas Schwinge


While looking a bit into the item raised in I noticed the following
(mis?)behavior by notmuch.

To set the stage:

    $ yes | head -n 1
    $ echo "${PIPESTATUS[@]}"
    141 0

As expected, the 'yes' process exits with SIGPIPE right after the 'head'
process terminated.  However:

    $ notmuch search \* | head -n 1 & sleep 22; jobs; ps -f
    [1] 622009
    thread:0000000000032bb2   the future [1/1] Jenna Moss; Steve Burbon, Washington (hurd list spam)
    [1]+  Running                 notmuch search \* | head -n 1 &
    UID          PID    PPID  C STIME TTY          TIME CMD
    thomas    621851    4297  0 12:38 pts/38   00:00:00 /bin/bash
    thomas    622008  621851 99 12:48 pts/38   00:00:22 /home/thomas/command/notmuch.real search \*
    thomas    622013  621851  0 12:48 pts/38   00:00:00 ps -f

Even after its "pipe-consumer" 'head' process has terminated, the
'notmuch' process still keeps running, and running, and running...  It
has to be killed manually (unless it before exits because of concurrent
database modification).  This doesn't seem expected behavior to me?

Now, I do have a patch or two (actually dozensa; reverts, WIP etc.) on
top of months-old notmuch sources, so I'll later try to reproduce that
with clean sources.

signature.asc (application/pgp-signature)
notmuch mailing list