Bug 354597

Summary: incorrect date/time for FTP files
Product: [Frameworks and Libraries] frameworks-kio Reporter: ssemenukha <semmy>
Component: generalAssignee: David Faure <faure>
Severity: normal CC: frank78ac, kdelibs-bugs, philippep62, scarfhogg, wbauer1
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
URL: https://www.facebook.com/photo.php?fbid=1186973697983643&set=a.469901019690918.121306.100000130726946&type=3&theater
Latest Commit: Version Fixed In: 5.19.0
Sentry Crash Report:
Attachments: incorrect and correct date/time screenshot

Description ssemenukha 2015-10-30 10:36:18 UTC
OS: Kubuntu 15.10 upgraded from 15.04
Locale: Ukraine

Actually dolphin show incorrect date/time for FTP files.

Reproducible: Always

Steps to Reproduce:
1. Connect to any FTP server
2. Enter enywhere
3. Right click on file and select "Item properties"

Actual Results:  
incorrect date/time for FTP files

Expected Results:  
correct date/time for FTP files
Comment 1 ssemenukha 2015-10-30 10:39:35 UTC
Created attachment 95221 [details]
incorrect and correct date/time screenshot

Actual date/time of file "master.css" is: 2015, october 30 02:16
Dialog shows date: 2106, february 7
Comment 2 kdave 2015-12-17 07:32:35 UTC
Confirmed on Kubuntu 15.10
Comment 3 kdave 2015-12-17 07:35:41 UTC
Dolphin version 15.08.2 / KDE Frameworks 5.15.0 / Qt 5.4.2
Comment 4 Philippe Piquer 2015-12-20 17:51:48 UTC
Same as above for me.
Comment 5 Frank Reininghaus 2015-12-23 14:24:54 UTC
Thanks for the bug report. Do you see the same issue in the file dialog of KWrite or other KDE applications?
Comment 6 kdave 2015-12-23 14:42:13 UTC
Yes, just tried with the Kate file dialog. It has the same issue.
Comment 7 Frank Reininghaus 2015-12-23 15:10:59 UTC
Thanks for the quick reply! It probably is a bug either in the ftp/sftp kioslave or in the KIO framework then.
Comment 8 Wolfgang Bauer 2016-01-07 10:01:05 UTC
I had a look at this, the problem is that the year is calculated wrong in kio_ftp.

Proposed fix:
Comment 9 Wolfgang Bauer 2016-01-07 12:46:16 UTC
Git commit 68af1d7e89b7fed136d4cc62b76c1c6ded2d94eb by Wolfgang Bauer.
Committed on 07/01/2016 at 12:38.
Pushed by wbauer into branch 'master'.

[kio_ftp] fix display of file/directory modification time/date

- QDate() treats the year literally (i.e. 90 is really year 90, not
  1990), so subtracting 1900 is wrong.
- Use QDate::currentDate() instead of QDateTime::currentDateTime(), we
  only need the current date anyway
- Initialize day, month, and year to the current date instead of 0. In
  the case when no year is mentioned in the server's reply (the year is
implicit), it wasn't set to the current year at all, so the result was
either 0 or -1.
FIXED-IN: 5.19.0
REVIEW: 126659

M  +8    -10   src/ioslaves/ftp/ftp.cpp