bugGNU Wget - Bugs: bug #21505, Date-parsing issues with FTP

 
 

bug #21505: Date-parsing issues with FTP

Submitter:  Micah Cowan <micahcowan>
Submitted:  Fri 02 Nov 2007 04:23:12 PM UTC
   
 
Category:  Program Logic Severity:  2 - Minor
Priority:  3 - Low Status:  Needs Investigation
Privacy:  Public Assigned to:  None
Originator Name:  Philip Gladstone Open/Closed:  Open
Release:  1.10.2 Operating System:  None
Reproducibility:  None Fixed Release:  None
Planned Release:  1.15 Regression:  No
Work Required:  0 - Hours Patch Included:  Yes
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 08 Dec 2007 10:03:31 PM UTC, comment #1: 

A good idea; but the patch is incomplete. It only checks whether the file's time is in the first day of the next month, but not whether the current time is the last day of the current month. We need to do a stronger check for whether it's truly within 24 hours of the current time.

Micah Cowan <micahcowan>
Fri 02 Nov 2007 04:23:12 PM UTC, original submission:  

From patches ML, Philip Gladstone writes:

Brief outline:

When you do a wget from an ftp: url, it tries to copy over the last modified date of the file (this is good). However, due to timezone issues, the date that it gets can sometimes be in the future, and then it guesses the year incorrectly. This patch fixes that problem.


--- wget-1.10.2/src/ftp-ls.c        2005-08-04 17:52:33.000000000 -0400
+++ wget-1.10.2-fixed/src/ftp-ls.c        2006-10-28 15:09:58.000000000 -0400
@@ -410,10 +410,19 @@
              is 97-01-12, and you see a file of Dec 15th, its year is
              1996, not 1997.  Thanks to Vladimir Volovich for
              mentioning this!  */
-          if (month > tnow->tm_mon)
-            timestruct.tm_year = tnow->tm_year - 1;
-          else
-            timestruct.tm_year = tnow->tm_year;
+          /* However, due to timezone differences, you can get files for
+             up to 24 hours in the future. If these cross a month or year
+             end, then you have problems - pjsg */
+          if (day == 1 && month == ((tnow->tm_mon + 1) % 12))
+            if (month == 0)
+              timestruct.tm_year = tnow->tm_year + 1;
+            else
+              timestruct.tm_year = tnow->tm_year;
+          else
+            if (month > tnow->tm_mon)
+              timestruct.tm_year = tnow->tm_year - 1;
+            else
+              timestruct.tm_year = tnow->tm_year;
         }
       else
         timestruct.tm_year = year;


Micah Cowan <micahcowan>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by micahcowan (Submitted the item)
  •  

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-04-14 micahcowan StatusNeeds Discussion Needs Investigation
    2008-01-27 micahcowan Planned Release1.12 1.15
    2007-12-08 micahcowan Priority9 - Immediate 3 - Low
        StatusConfirmed Needs Discussion
    2007-11-02 micahcowan Priority5 - Normal 9 - Immediate

    Back to the top

    Powered by Savane 3.13-5190.
    Corresponding source code