Hi!

On Thu, 2015-04-16 at 19:32:30 +0000, JimC wrote:
> Package: inetutils-ping
> Version: 2:1.9.2.39.3a460-3
> Severity: normal
> Tags: newcomer

> We have an app that forks() a copy of ping, parses it's
> responses and add these responses to an RRD chart. We've
> been using this successfully on various version of CentOS,
> RHEL, FreeBSD and Ubuntu, but today when we ported to Debian
> Jessie, we discovered that it uses line buffering. 

Actually the problem is that stdout when redirected to a file switches
to fully buffered output, contrary to when writing to a terminal where
it does line buffering.

> We'd prefer to use inetutils-ping as it is included by
> default on most debian systems. And that makes it easily
> available to Docker images built on debian.

(Just curious, but what do you mean with "included by default"? It's
Priority: extra, while iputils-ping is Priority: important.)

> If you agree this is something that should be corrected, I
> believe it's a simple matter of adding fflush(STDOUT) around
> line 191 of ping_echo.c (just before the return from the
> function print_echo()).

I think fixing this is fine, and I'll do so in my next upload. The
attached patch should do it.

Thanks,
Guillem
diff --git a/ping/ping.c b/ping/ping.c
index 3f939dc..3d1a004 100644
--- a/ping/ping.c
+++ b/ping/ping.c
@@ -295,6 +295,9 @@ main (int argc, char **argv)
   /* Reset root privileges */
   setuid (getuid ());
 
+  /* Force line buffering regardless of output device. */
+  setvbuf (stdout, NULL, _IOLBF, 0);
+
   argv += index;
   argc -= index;
 
diff --git a/ping/ping6.c b/ping/ping6.c
index 9d7609e..fd14648 100644
--- a/ping/ping6.c
+++ b/ping/ping6.c
@@ -254,6 +254,9 @@ main (int argc, char **argv)
   /* Reset root privileges */
   setuid (getuid ());
 
+  /* Force line buffering regardless of output device. */
+  setvbuf (stdout, NULL, _IOLBF, 0);
+
   argc -= index;
   argv += index;
 

Reply via email to