On 20/03/12 08:00, Ray Satiro wrote: > Actually it looks like there is a problem with some later versions. > > ---request begin--- > GET /fedora/releases/16/Fedora/i386/iso/Fedora-16-i386-DVD.iso HTTP/1.1 > Range: bytes=-2147483648- > User-Agent: Wget/1.13.1 (mingw32) > Accept: */* > Host: mirrors.kernel.org > Connection: Keep-Alive > > ---request end--- > > The 1.11.4 version I have from gnuwin32 looks fine though > > ---request begin--- > GET /fedora/releases/16/Fedora/i386/iso/Fedora-16-i386-DVD.iso HTTP/1.0 > Range: bytes=2147483648- > User-Agent: Wget/1.11.4 > Accept: */* > Host: mirrors.kernel.org > Connection: Keep-Alive > > ---request end--- > > > If you want the latest version the maintainer of mypaint compiled Wget/1.13.4 > (mingw32) > > go here > http://opensourcepack.blogspot.com/2010/05/wget-112-for-windows.html > click on wget-1.13.4 > > So it looks there was (and probably still is) a problem with the fstat > replacement. I don't see anything submitted. Confirmed. It is still present in trunk. The only big OS affected is probably windows 32 bit (maybe some non __USE_LARGEFILE64 systems are, too).
The bug is on line 3058 of http.c hstat.restval = st.st_size; st_size is a 32 bit off_t, being sign-extended to a 64 bit wgint. I don't think it can be fixed at that point. I would replace the stat to stati64. In fact, wget code seems designed to do that, see the struct_stat comment in sysdep.h I was able to build a wget without the issue by adding this to mswindows.h > --- src/mswindows.h 2011-08-13 08:43:43 +0000 > +++ src/mswindows.h 2012-03-20 19:20:01 +0000 > @@ -102,6 +102,11 @@ > # define fstat(f, b) fstat_alias (f, b) > #endif > > +#define struct_stat struct _stati64 > +#define struct_fstat struct _stati64 > +#undef stat > +#define stat _stati64 > + > #define PATH_SEPARATOR '\\' > > /* Additional declarations needed for IPv6: */ > This bypasses gnulib stat, though.
