Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 1997 01:00:48 -0800 (PST)
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
Message-ID:  <Pine.BSF.3.95q.970210003848.21086K-100000@hydrogen.nike.efn.org>
In-Reply-To: <199702100648.BAA04252@rtfm.ziplink.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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)





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.970210003848.21086K-100000>