* [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.
@ 2017-01-20 14:49 Pedro Miguel Carvalho
2017-01-31 12:03 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Pedro Miguel Carvalho @ 2017-01-20 14:49 UTC (permalink / raw)
To: util-linux
[-- 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 --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [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.
2017-01-20 14:49 [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 Pedro Miguel Carvalho
@ 2017-01-31 12:03 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2017-01-31 12:03 UTC (permalink / raw)
To: Pedro Miguel Carvalho; +Cc: util-linux
On Fri, Jan 20, 2017 at 02:49:18PM +0000, Pedro Miguel Carvalho wrote:
> "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.
Fixed. Thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-31 12:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-20 14:49 [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 Pedro Miguel Carvalho
2017-01-31 12:03 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox