From mi@rtfm.ziplink.net  Sun Feb  9 22:48:22 1997
Received: from rtfm.ziplink.net ([199.232.255.52])
          by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id WAA12956
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 9 Feb 1997 22:48:12 -0800 (PST)
Received: (from mi@localhost) by rtfm.ziplink.net (8.8.5/8.7.3) id BAA04252; Mon, 10 Feb 1997 01:48:22 -0500 (EST)
Message-Id: <199702100648.BAA04252@rtfm.ziplink.net>
Date: Mon, 10 Feb 1997 01:48:22 -0500 (EST)
From: Mikhail Teterin <mi@aldan.ziplink.net>
Reply-To: mi@aldan.ziplink.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: fetch's reporting incorrect
X-Send-Pr-Version: 3.2

>Number:         2700
>Category:       bin
>Synopsis:       fetch -r reports K/s ratio as the whole file was fetched
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb  9 22:50:02 PST 1997
>Closed-Date:    Mon Feb 10 10:50:43 PST 1997
>Last-Modified:  Mon Feb 10 10:51:15 PST 1997
>Originator:     Mikhail Teterin
>Release:        FreeBSD 3.0-970118-SNAP i386
>Organization:
Virtual Estates, Inc.
>Environment:
>Description:

	fetch(1) will use the full length of the file when computing
	Kb per second ratio -- even if part of the file was already
	here and -r (reget) option was specified

>How-To-Repeat:

	get 95% of some file. The use fetch -r to get the rest.
	Get amazed with your network connection.

>Fix:
	
	See the priority and severity. Just ignore fetch's reporting
	for this cases.
>Release-Note:
>Audit-Trail:

From: John-Mark Gurney <jmg@nike.efn.org>
To: Mikhail Teterin <mi@aldan.ziplink.net>
Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freefall.freebsd.org
Subject: Re: bin/2700: fetch's reporting incorrect
Date: Mon, 10 Feb 1997 01:00:48 -0800 (PST)

 On Mon, 10 Feb 1997, Mikhail Teterin wrote:
 
 > >Fix:
 > 	
 > 	See the priority and severity. Just ignore fetch's reporting
 > 	for this cases.
 
 ok... I found the bug.. basicly it turns out that seekloc and wehave
 wasn't set properly...  
 
 did you make sure that the file was transfered completely?  on my builds
 the file transfer wasn't completed... i.e. it didn't fetch the remaining
 file...  at least with my experience it wasn't...
 
 here's the patch to fix the problem with it not completing the transfer... 
 and reporting "exessive" speeds (like 55K/s for my 28.8kbps modem on a
 gzipped binary :) )... and that the -R option though it exists (and
 documented in the man page) wasn't being passed to getopt... 
 
 also... should we document the ncftp "compatibility" in the man page??
 
 here's the patch to fix 'em all...   ttyl..
 
 Index: ftp.c
 ===================================================================
 RCS file: /usr/cvs/src/usr.bin/fetch/ftp.c,v
 retrieving revision 1.2
 diff -c -r1.2 ftp.c
 *** ftp.c	1997/02/05 19:59:12	1.2
 --- ftp.c	1997/02/10 08:40:17
 ***************
 *** 327,333 ****
   		}
   		if (fs->fs_restart) {
   			if (stab.st_size != 0 && stab.st_size < size)
 ! 				seekloc = wehave = size;
   		}
   	}
   
 --- 327,333 ----
   		}
   		if (fs->fs_restart) {
   			if (stab.st_size != 0 && stab.st_size < size)
 ! 				seekloc = wehave = stab.st_size;
   		}
   	}
   
 Index: main.c
 ===================================================================
 RCS file: /usr/cvs/src/usr.bin/fetch/main.c,v
 retrieving revision 1.34
 diff -c -r1.34 main.c
 *** main.c	1997/02/05 19:59:16	1.34
 --- main.c	1997/02/10 08:52:51
 ***************
 *** 73,79 ****
       fs.fs_verbose = 1;
       change_to_dir = file_to_get = hostname = 0;
   
 !     while ((c = getopt(argc, argv, "ac:D:f:h:HilLmMnNo:pPqrT:vV:")) != -1) {
   	    switch (c) {
   	    case 'D': case 'H': case 'I': case 'N': case 'L': case 'V': 
   		    break;	/* ncftp compatibility */
 --- 73,79 ----
       fs.fs_verbose = 1;
       change_to_dir = file_to_get = hostname = 0;
   
 !     while ((c = getopt(argc, argv, "ac:D:f:h:HilLmMnNo:pPqRrT:vV:")) != -1) {
   	    switch (c) {
   	    case 'D': case 'H': case 'I': case 'N': case 'L': case 'V': 
   		    break;	/* ncftp compatibility */
 ***************
 *** 286,291 ****
 --- 286,292 ----
   display(struct fetch_state *fs, off_t size, ssize_t n)
   {
       static off_t bytes;
 +     static off_t bytestart;
       static int pr, init = 0;
       static struct timeval t0, t_start;
       static char *s;
 ***************
 *** 309,315 ****
   	    sprintf (s, "Receiving %s", fs->fs_outputfile);
   	printf ("%s", s);
   	fflush (stdout);
 ! 	bytes = n;
   	return;
       }
       gettimeofday(&t, &tz);
 --- 310,316 ----
   	    sprintf (s, "Receiving %s", fs->fs_outputfile);
   	printf ("%s", s);
   	fflush (stdout);
 ! 	bytestart = bytes = n;
   	return;
       }
       gettimeofday(&t, &tz);
 ***************
 *** 318,323 ****
 --- 319,325 ----
   	    printf ("\r%s: 100%%", s);
   	else
   	    printf ("\r%s: %qd Kbytes", s, (quad_t)bytes/1024);
 + 	bytes -= bytestart;
   	d = t.tv_sec + t.tv_usec/1.e6 - t_start.tv_sec - t_start.tv_usec/1.e6;
   	printf ("\n%qd bytes transfered in %.1f seconds", (quad_t)bytes, d); 
   	d = bytes/d;
 
 
 John-Mark
 
 gurney_j@efn.org
 http://resnet.uoregon.edu/~gurney_j/
 Modem/FAX: (541) 683-6954   (FreeBSD Box)
 
 Live in Peace, destroy Micro$oft, support free software, run FreeBSD (unix)
 
 
State-Changed-From-To: open->closed 
State-Changed-By: wollman 
State-Changed-When: Mon Feb 10 10:50:43 PST 1997 
State-Changed-Why:  
Applied patch from John-Mark Gurney. 
>Unformatted:

