sftp: do not show creation time when we do not know it
ClosedPublic

Authored by sitter on Mar 5 2020, 2:59 PM.

Details

Summary

creation time (aka birth time) is file system dependent, if the fs doesn't
support it we seem to get createtime==0. skip over it when that is the
case.

BUG: 375305
FIXED-IN: 20.04

Test Plan

browsing a directory on btrfs over sftp doesn't show creation time as 1970

Diff Detail

Repository
R320 KIO Extras
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
sitter created this revision.Mar 5 2020, 2:59 PM
Restricted Application added projects: Dolphin, Frameworks. · View Herald TranscriptMar 5 2020, 2:59 PM
Restricted Application added subscribers: kfm-devel, kde-frameworks-devel. · View Herald Transcript
sitter requested review of this revision.Mar 5 2020, 2:59 PM
ngraham accepted this revision.Mar 5 2020, 3:18 PM
This revision is now accepted and ready to land.Mar 5 2020, 3:18 PM
bruns requested changes to this revision.Mar 5 2020, 9:06 PM
bruns added a subscriber: bruns.

Btrfs definitely does support birthtime

sftp/kio_sftp.cpp
491–496

You should check for SSH_FILEXFER_ATTR_CREATETIME in the flags field:
https://api.libssh.org/master/group__libssh__sftp.html#gabbfacf308d2116ae09b1ca4f901afe2d

This revision now requires changes to proceed.Mar 5 2020, 9:06 PM
sitter updated this revision to Diff 77080.Mar 6 2020, 10:37 AM

use flaggy

bruns requested changes to this revision.Mar 6 2020, 6:50 PM

Please correct the comment in the code - it depends on the server SFTP implementation.

This revision now requires changes to proceed.Mar 6 2020, 6:50 PM

Please correct the comment in the code - it depends on the server SFTP implementation.

Birth time does not depend on the file system?

meven added a subscriber: meven.Mar 24 2020, 10:19 AM

Please correct the comment in the code - it depends on the server SFTP implementation.

Birth time does not depend on the file system?

I guess on both but ultimately on the SFTP implementation that can lack the implementation when the underlying filesystem has the birth time.

meven accepted this revision.Mar 24 2020, 2:20 PM

Ok to me @bruns ?

bruns added a comment.Mar 24 2020, 5:20 PM

Looks ok now.

Should be followed up by a corresponding change for ACCESS_TIME/MODIFICATION_TIME - both are optional as well.

bruns accepted this revision.Mar 24 2020, 5:20 PM
This revision is now accepted and ready to land.Mar 24 2020, 5:20 PM
This revision was automatically updated to reflect the committed changes.