From: Pedro Miguel Carvalho <PedroMC@pmc.com.pt>
To: util-linux@vger.kernel.org
Subject: [PROBLEM] "findmnt --poll" does not flush stdout causing it to buffer the output more than it should when the output is to a pipe or file.
Date: Fri, 20 Jan 2017 14:49:18 +0000 [thread overview]
Message-ID: <1493264.gvqBJzGE5V@marte> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1517 bytes --]
=2D-nextPart1865518.7uAhIVuNxy
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
"findmnt --poll" does not flush stdout causing it to buffer the
output more than it should when the output is to a pipe or file.
This issue can be observed by comparing the output of:
findmnt --poll --pairs
with the output of:
findmnt --poll --pairs | tee /tmp/output.log
when these two command are run at the same time
and some filesystems are (un)(re)mounted.
Redirecting the output to a file:
findmnt --poll --pairs > /tmp/output.log
or executing findmnt with ssh:
ssh user@server findmnt --poll --pairs
also show the same symptom.
The attached patch simply adds a "fflush(stdout);" after the
output is printed.
Thanks
p.s. I'm not certain if this is the proper place and way to
report this issue. If this should go somewhere else, please
point me in the right direction.
=2D-nextPart1865518.7uAhIVuNxy
Content-Disposition: attachment; filename="findmnt.patch"
Content-Transfer-Encoding: 7Bit
Content-Type: text/x-patch; charset="UTF-8"; name="findmnt.patch"
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index aff2847..3984d44 100644
=2D-- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -1142,6 +1142,7 @@ static int poll_table(struct libmnt_table *tb, const char *tabfile,
if (count) {
rc = scols_table_print_range(table, NULL, NULL);
+ fflush(stdout);
if (rc)
goto done;
}
=2D-nextPart1865518.7uAhIVuNxy--
This is a multi-part message in MIME format.
[-- Attachment #1.2: Type: text/plain, Size: 783 bytes --]
"findmnt --poll" does not flush stdout causing it to buffer the
output more than it should when the output is to a pipe or file.
This issue can be observed by comparing the output of:
findmnt --poll --pairs
with the output of:
findmnt --poll --pairs | tee /tmp/output.log
when these two command are run at the same time
and some filesystems are (un)(re)mounted.
Redirecting the output to a file:
findmnt --poll --pairs > /tmp/output.log
or executing findmnt with ssh:
ssh user@server findmnt --poll --pairs
also show the same symptom.
The attached patch simply adds a "fflush(stdout);" after the
output is printed.
Thanks
p.s. I'm not certain if this is the proper place and way to
report this issue. If this should go somewhere else, please
point me in the right direction.
[-- Attachment #1.3: findmnt.patch --]
[-- Type: text/x-patch, Size: 355 bytes --]
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index aff2847..3984d44 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -1142,6 +1142,7 @@ static int poll_table(struct libmnt_table *tb, const char *tabfile,
if (count) {
rc = scols_table_print_range(table, NULL, NULL);
+ fflush(stdout);
if (rc)
goto done;
}
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next reply other threads:[~2017-01-20 15:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-20 14:49 Pedro Miguel Carvalho [this message]
2017-01-31 12:03 ` [PROBLEM] "findmnt --poll" does not flush stdout causing it to buffer the output more than it should when the output is to a pipe or file Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1493264.gvqBJzGE5V@marte \
--to=pedromc@pmc.com.pt \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox