Subject: Re: bin/33207: progress(1) w/ stdin: useless progress bar
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: Hubert Feyrer <hubert@feyrer.de>
List: netbsd-bugs
Date: 04/06/2006 12:50:03
The following reply was made to PR bin/33207; it has been noted by GNATS.
From: Hubert Feyrer <hubert@feyrer.de>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/33207: progress(1) w/ stdin: useless progress bar
Date: Thu, 6 Apr 2006 14:46:23 +0200 (CEST)
Doing some more research, I think this is related to the detection if the
progress bar should be printed. My gut feeling tells me this should be the
same in both cases:
case 1:
wl3403% cat /netbsd | ./obj.i386/progress dd of=/dev/null
0 0.00 KB/s 8117+1 records in
8117+1 records out
4156040 bytes transferred in 0.218 secs (19064403 bytes/sec)
4058 KB 15.07 MB/s
case 2:
wl3403% ./obj.i386/progress </netbsd dd of=/dev/null
0% | | 0 0.00 KB/s --:-- ETA8117+1 records in
8117+1 records out
4156040 bytes transferred in 0.159 secs (26138616 bytes/sec)
100% |*************************************| 4058 KB 24.24 MB/s 00:00 ETA
FWIW, the test is in src/usr.bin/ftp/progress.c's foregroundproc():
static pid_t pgrp = -1;
if (pgrp == -1)
pgrp = getpgrp();
return (tcgetpgrp(fileno(ttyout)) == pgrp);
I wonder if the test shouldn't rather see if input is coming from a file
or pipe...
- Hubert