"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.
"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.
misc-utils/findmnt.c +1 -0
@@ -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; }
Karel Zak
maintainerQuoted 2 lines · Pedro Miguel Carvalho
"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
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com