Subject: ftp(1) ETA overflow.
To: None <netbsd-users@netbsd.org>
From: Martin S. Weber <Ephaeton@gmx.net>
List: netbsd-users
Date: 11/04/2007 15:20:33
Hoi,

When downloading a somewhat bigger file with ftp, its ETA display
at times goes havoc, going from somewhere positive to weird negative
values. And then switches back to some time that makes sense.

40% |***************************                                          |   252 MiB  216.05 KiB/s -596523:-14:-
and then later
56% |**************************************                               |   356 MiB  213.86 KiB/s    21:39 ETA

More of it can be seen at phaeton.sdf-eu.org/seltsam-shot.png

This looks like an overflow issue of a signed integer (Note that:
596523*60*60+14*60 = 2147483640 in seconds which is "near" to
2^31-1 (actually just 7 seconds away and those are probably just
scrolled to the next line?). Shouldn't the ETA be unsigned??

Is it me again with my hosed system or has anybody seen something
like that before? Inclined to file a PR...

$ ident `which ftp`
/usr/bin/ftp:
     $NetBSD: crt0.c,v 1.16 2006/05/17 17:08:54 christos Exp $
     $NetBSD: cmds.c,v 1.123 2007/05/24 05:05:18 lukem Exp $
     $NetBSD: cmdtab.c,v 1.47 2007/04/11 04:40:19 lukem Exp $
     $NetBSD: complete.c,v 1.42 2007/04/17 05:52:03 lukem Exp $
     $NetBSD: domacro.c,v 1.21 2005/06/29 02:31:19 christos Exp $
     $NetBSD: fetch.c,v 1.182 2007/08/22 23:47:13 lukem Exp $
     $NetBSD: ftp.c,v 1.152 2007/07/22 05:02:50 lukem Exp $
     $NetBSD: main.c,v 1.105 2007/05/22 05:16:48 lukem Exp $
     $NetBSD: progressbar.c,v 1.17 2007/05/05 18:09:24 martin Exp $
     $NetBSD: ruserpass.c,v 1.33 2007/04/17 05:52:04 lukem Exp $
     $NetBSD: util.c,v 1.143 2007/05/24 05:05:19 lukem Exp $

$ uname -sr
NetBSD 4.99.31

Regards,

-Martin