Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Apr 2023 14:52:47 -0700
From:      Pete <freebsd-questions-3@voidcaptain.com>
To:        questions@freebsd.org
Subject:   Clogged pipe?
Message-ID:  <f8a7a545-9731-7481-4fb2-bfc77b8ad6f0@slagle.net>

next in thread | raw e-mail | index | archive | help
On FreeBSD 13.1-RELEASE-p7 I have a small test file, named testfile, 
which contains three short lines of text, "one," "two," and "three" 
without the quotes.

This command waits indefinitely without producing any output:

   tail -f testfile | cat -n | sed -u 's/^/X/'

But, these five commands all work as expected, immediately outputting 
versions of the three lines of text:

   tail -f testfile | cat -n
   cat -n testfile | sed -u 's/^/X/'
   tail -f testfile | sed -u 's/^/X/'
   tail testfile | cat -n | sed -u 's/^/X/'
   tail -f testfile | cat | sed -u 's/^/X/'

What is it about the first command, that causes it to produce no output, 
that isn't also the case with any of the last five?

It doesn't matter whether the commands are run in sh, csh, or bash, the 
result is the same.

Interestingly (or maybe not), the issue doesn't occur on my Debian box; 
all six commands produce immediate output there in both dash and bash.

Can anyone explain what makes the first command behave differently than 
the others?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f8a7a545-9731-7481-4fb2-bfc77b8ad6f0>