Bug 397398 - Misleading ‘Created’ date in file properties
Summary: Misleading ‘Created’ date in file properties
Status: RESOLVED FIXED
Alias: None
Product: krusader
Classification: Applications
Component: general (show other bugs)
Version: 2.7.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Alex Bikadorov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-12 11:30 UTC by Karl Ove Hufthammer
Modified: 2019-07-01 07:19 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot showing properties window launched from Krusader (79.22 KB, image/png)
2018-08-12 11:30 UTC, Karl Ove Hufthammer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Ove Hufthammer 2018-08-12 11:30:11 UTC
Created attachment 114415 [details]
Screenshot showing properties window launched from Krusader

The KIO ‘Properties’ window for a file shows three dates:

  Created:
  Modified:
  Accessed:

However, the ‘Created’ date seems to be the ‘ctime’, which is *not* the creation time for the file. I have a bunch of files with apparently have been ‘modified’ *before* their ‘Created’ date, which is chronologically impossible. (See screenshot.)

Note 1: What is shown in the ‘Properties’ window seems to depend on how it’s accessed. Accessing it via Dolphin doesn’t show the ‘Created’ field, but accessing it via Krusader does. (In both cases the window comes from KIO, not the host application.)

Note 2: Unix/Linux filesystems doesn’t store the creation time in a *standard* field:
https://unix.stackexchange.com/questions/7562/what-file-systems-on-linux-store-the-creation-time

Note 3: Explanation of ctime, atime and mtime
https://www.unixtutorial.org/2008/04/atime-ctime-mtime-in-unix-filesystems/
Comment 1 Karl Ove Hufthammer 2018-08-12 11:55:33 UTC
I believe the *real* creation time (if available) can be found using
  QFileInfo::birthTime()
available in Qt 5.10+
https://doc.qt.io/qt-5/qfileinfo.html#birthTime
Comment 2 Kai Uwe Broulik 2018-08-12 13:36:20 UTC
Technically, that file was "Created" on that given date. However, I can see your point. From what I can tell there's UDS_CREATION_TIME in UDSEntry which might be set to birth time depending on platform/fs.
Comment 3 Nate Graham 2018-08-21 19:14:26 UTC
*Real* creation time support on Linux is on my to-do list and is being tracked in Bug 381367.

Sadly it's not trivial to simply use QFileInfo::birthTime() because the entire way we populate this information is different. There's a glibc API in 2.28+, but that's generally newer than what most distros are shipping. Using the raw syscall for the next year or two is an option until we can make glibc 2.28 a dependency.

*** This bug has been marked as a duplicate of bug 381367 ***
Comment 5 Méven Car 2019-04-12 16:30:09 UTC
More precisely here : https://github.com/KDE/krusader/blob/a7ebda9a8054448f46feb044935236c86021bc29/krusader/FileSystem/filesystem.cpp#L238

It uses stat ctime as creation time, but it is the change status time.

To get the creation time, also called birth time, of files, there is a new syscall statx more complete than stat available since glib 2.28.
Comment 6 Alex Bikadorov 2019-04-14 11:34:02 UTC
Thanks for the information Méven!

Supporting statx with ifdef logic may be too costly. But we should at least fix the mix-up of creation time and ctime.
Comment 7 Alex Bikadorov 2019-04-22 15:59:25 UTC
Proposed fix: https://phabricator.kde.org/D20741
Comment 8 Alex Bikadorov 2019-05-05 19:23:30 UTC
Git commit 0920b04b4a841c69cd482e34cfe3e2949d79b9c1 by Alexander Bikadorov.
Committed on 05/05/2019 at 19:20.
Pushed by abikadorov into branch 'master'.

FileSystem: Fix using creation time from KIO as changed time (ctime)

Added new field to FileItem instead. And do not show dummy value in UI for
missing file times - also for other time types.

FIXED: [ 397398 ] Misleading ‘Created’ date in file properties

Differential Revision: https://phabricator.kde.org/D20741

M  +2    -2    krusader/DiskUsage/diskusage.cpp
M  +11   -8    krusader/FileSystem/fileitem.cpp
M  +12   -5    krusader/FileSystem/fileitem.h
M  +7    -3    krusader/FileSystem/filesystem.cpp
M  +1    -1    krusader/FileSystem/krquery.cpp
M  +2    -2    krusader/Panel/PanelView/krsort.cpp
M  +8    -4    krusader/Panel/PanelView/listmodel.cpp
M  +1    -1    krusader/Panel/listpanel.cpp
M  +10   -10   krusader/Synchronizer/synchronizer.cpp

https://commits.kde.org/krusader/0920b04b4a841c69cd482e34cfe3e2949d79b9c1
Comment 9 Nikita Melnichenko 2019-07-01 07:19:53 UTC
Git commit 951ab660d7336c96a7e7a834f8499c6baa379dcd by Nikita Melnichenko.
Committed on 01/07/2019 at 07:16.
Pushed by melnichenko into branch 'stable'.

FileSystem: Fix using creation time from KIO as changed time (ctime)

Added new field to FileItem instead. And do not show dummy value in UI for
missing file times - also for other time types.

FIXED: [ 397398 ] Misleading ‘Created’ date in file properties

Differential Revision: https://phabricator.kde.org/D20741

(cherry picked from commit 0920b04b4a841c69cd482e34cfe3e2949d79b9c1)

M  +2    -2    krusader/DiskUsage/diskusage.cpp
M  +11   -8    krusader/FileSystem/fileitem.cpp
M  +12   -5    krusader/FileSystem/fileitem.h
M  +7    -3    krusader/FileSystem/filesystem.cpp
M  +1    -1    krusader/FileSystem/krquery.cpp
M  +2    -2    krusader/Panel/PanelView/krsort.cpp
M  +8    -4    krusader/Panel/PanelView/listmodel.cpp
M  +1    -1    krusader/Panel/listpanel.cpp
M  +10   -10   krusader/Synchronizer/synchronizer.cpp

https://commits.kde.org/krusader/951ab660d7336c96a7e7a834f8499c6baa379dcd