Greetings,

The following applies to wget-1.10.2.  The problem was noticed with wget
built/run on Solaris-9/SPARC and Solaris-10/x86, but I believe the problem
is independent of the platform.

Certain FTP server directory listings yield file sizes of zero bytes
when interpreted by wget-1.10.2.  The problem entries (as seen in the
wget-generated ".listing" file) have only a single blank between the
"group ownership" token and the file-size token, as can occur with
long group names and/or large file sizes.  Here is an example:

-r--r--r--   1 ftp      anonymous 48608258 Jan  3 12:01 swissprot.gz


And here is its resulting entry from the wget-generated index.html file:

  2006 Jan 03 12:01  File        <a href="ftp://ftp.ncbi.nih.gov:21/blast/db/FA
STA/swissprot.gz">swissprot.gz</a>  (0 bytes)


Attached below is a patch which fixes the problem, and also adds debug
output in order to help diagnose such problems should they occur with
other directory listing formats.

Regards,

-- 
Marion Hakanson <[EMAIL PROTECTED]>

--- ./src/ftp-ls.c.orig	Thu Aug  4 14:52:33 2005
+++ ./src/ftp-ls.c	Wed Jan  4 15:33:08 2006
@@ -228,6 +228,10 @@
 		      error = 1;
 		      break;
 		    }
+		  if ( t < ptok && *t == '\0' )
+		     /* backed up into former whitespace between tokens */
+		    t++;
+
 		  errno = 0;
 		  size = str_to_wgint (t, NULL, 10);
 		  if (size == WGINT_MAX && errno == ERANGE)
@@ -236,6 +240,7 @@
 		    cur.size = 0;
 		  else
 		    cur.size = size;
+		  DEBUGP (("size: %s(%s); ", number_to_static_string (cur.size), t));
 
 		  month = i;
 		  next = 5;

Reply via email to