Bug 55511 - KGET does not preserve timestamp of downloaded files from FTP
Summary: KGET does not preserve timestamp of downloaded files from FTP
Status: RESOLVED FIXED
Alias: None
Product: kget
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: KGet authors
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-04 16:43 UTC by wilbert
Modified: 2014-01-26 23:06 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.13


Attachments
Stat the FTP file after transfer to get mtime (4.07 KB, patch)
2013-03-19 06:24 UTC, David E. Narvaez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wilbert 2003-03-04 16:43:54 UTC
Version:           v0.8.3 (using KDE 3.1.0)
Installed from:    Gentoo
Compiler:          gcc version 3.2.1
OS:          Linux (i686) release 2.4.20

when I download files from FTP they always have the current time as timestamp. I think it would be better that KGet after downloading and closing the file would set the timestamp to the original timestamp that the file has on the ftp server.
Comment 1 Urs Wolfer 2005-09-20 14:26:44 UTC
This could be an option. I will put this on the KGet2 TODO list.
Comment 2 David E. Narvaez 2013-03-19 06:24:06 UTC
Created attachment 78195 [details]
Stat the FTP file after transfer to get mtime

I was taking a look at this bug and drafted this patch for the traditional KIO plugin. If this looks acceptable I can take on this bug and implement something similar in the rest of the plugins that need it.
Comment 3 Lukas Appelhans 2013-03-19 20:19:17 UTC
Hey!

It seems fine to me, in case there is no other way to get this data from ftp, which would use the original get job...

Also, to remove the boost dependency we could use:
        struct utimbuf time;
        time.modtime = modTime.toTime_t();
        time.actime = QDateTime::currentDateTime().toTime_t();
        utime(file.toUtf8().data(), &time);

Lukas
Comment 4 David E. Narvaez 2013-03-19 20:46:05 UTC
(In reply to comment #3)
> Hey!
> 
> It seems fine to me, in case there is no other way to get this data from
> ftp, which would use the original get job...

Looked for that all night and found nothing; I'll take a look again today. That may actually be a good addition for KIO, I'm not sure how easy it is to implement with the current code though.

> Also, to remove the boost dependency we could use:
>         struct utimbuf time;
>         time.modtime = modTime.toTime_t();
>         time.actime = QDateTime::currentDateTime().toTime_t();
>         utime(file.toUtf8().data(), &time);

Heh, I actually tried to avoid the code above by using Boost (since it is already used by qPGPMe). Anyhow, your call!

So for MultiSegmentKio, would this work? My concern is that all mirrors may not have the same mtime, can that happen?
Comment 5 Lukas Appelhans 2013-03-20 10:09:35 UTC
:D Well to me the boost code looked more complicated to me than the utime call. :)

Yes that can definitely happen, think about mirrors of ISOs which copy from each other.

Lukas
Comment 6 David E. Narvaez 2014-01-26 23:06:34 UTC
Git commit abb4133360dddbe8f49ca318ec977e3db15ea448 by David E. Narvaez.
Committed on 26/01/2014 at 23:06.
Pushed by narvaez into branch 'master'.

Set mtime When Transfering From FTP

Added code to spawn a stat job from MultisegmentKio and Kio transfer
plugins, which are the two plugins that handle FTP transfers.
FIXED-IN: 4.13
REVIEW: 115319

M  +28   -1    transfer-plugins/kio/transferKio.cpp
M  +1    -0    transfer-plugins/kio/transferKio.h
M  +26   -1    transfer-plugins/multisegmentkio/transfermultisegkio.cpp
M  +1    -0    transfer-plugins/multisegmentkio/transfermultisegkio.h

http://commits.kde.org/kget/abb4133360dddbe8f49ca318ec977e3db15ea448