Metadata Date/Time Of File Creation, Modification And Access Doesn't Work

Hello, on April 20 at 11:45 am I created a text file; on April 25 at 8:20 am I modified it; and today April 30 at 10:10 am I accessed it. I wanted to check these metadata that I quoted previously on my file. So, to check them, I used the program Stat but also Thunar and they allowed me to check the date and time of access of a file, the creation, the modification, etc. To understand better, here is what I get with Stat :

$ stat /home/thanks/Docs/bus
File : /home/thanks/Docs/bus
Size : 12 Blocs : 8 Blocs d’E/S : 4096 file
Device: 8,6 Inode: 3146970 Links: 1
Access : (0644/-rw-r–r–) UID : ( 1000/ thanks) GID : ( 1000/ thanks)
Access : 2022-04-30 10:16:11.957110864 +0200
Modif. : 2022-04-30 10:16:11.957110864 +0200
Changt : 2022-04-30 10:16:11.960444258 +0200
Created : 2022-04-30 10:16:11.957110864 +0200

While normally, I am supposed to have this:

$ stat /home/thanks/Docs/bus
File : /home/thanks/Docs/bus
Size : 12 Blocs : 8 Blocs d’E/S : 4096 file
Device: 8,6 Inode: 3146970 Links: 1
Access : (0644/-rw-r–r–) UID : ( 1000/ thanks) GID : ( 1000/ thanks)
Access : 2022-04-30 10:10:11.957110864 +0200
Modif. : 2022-04-25 08:20:11.957110864 +0200
Changt : 2022-04-30 10:16:11.960444258 +0200
Created : 2022-04-20 11:45:11.957110864 +0200

This problem occurs for all my files and folders and seems to occur since the last update of my Manjaro xfce system.
It seems to me (see certain), that it is to an application such as for example: fs.inotify (kernel module), watchman, iwatch, etc; to manage and update the metadata of creation, modification, access, etc on files and folders, yes or no? If yes, what is the best?
How to solve this problem?
What’s going on with Manjaro xfce which is supposed to use one of the mentioned applications? Because it’s worrying…Knowing that, I just use my Manjaro xfce system for word processing and going on the web, I don’t even install any application or else one or two.
Thank you a lot for your help!

Hello @Thanks :wink:

On a Linux Filesystem, the “Birth Date” of a file is fixed and cannot be modified with default tools. Only way to change that is recreating the file: remove & create or overwrite.

So my question: How do you “access” the file?

Ok here test…

  1. File created:
[user@manjaro ~]$ touch testfile && stat testfile
  File: testfile
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 0,41	Inode: 7657366     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    user)   Gid: ( 1000/    user)
Access: 2022-04-30 15:42:59.824381806 +0200
Modify: 2022-04-30 15:42:59.824381806 +0200
Change: 2022-04-30 15:42:59.824381806 +0200
 Birth: 2022-04-30 15:42:59.824381806 +0200
  1. File changed and modified:
[user@manjaro ~]$ echo "text" > testfile && stat testfile
  File: testfile
  Size: 5         	Blocks: 8          IO Block: 4096   regular file
Device: 0,41	Inode: 7657366     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    user)   Gid: ( 1000/    user)
Access: 2022-04-30 15:42:59.824381806 +0200
Modify: 2022-04-30 15:43:44.371405132 +0200
Change: 2022-04-30 15:43:44.371405132 +0200
 Birth: 2022-04-30 15:42:59.824381806 +0200
  1. Touch updates Access, Modify and Change, but not Birth:
[user@manjaro ~]$ touch testfile && stat testfile
  File: testfile
  Size: 5         	Blocks: 8          IO Block: 4096   regular file
Device: 0,41	Inode: 7657366     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    user)   Gid: ( 1000/    user)
Access: 2022-04-30 15:45:19.182187755 +0200
Modify: 2022-04-30 15:45:19.182187755 +0200
Change: 2022-04-30 15:45:19.182187755 +0200
 Birth: 2022-04-30 15:42:59.824381806 +0200
  1. Cat change nothing:
[user@manjaro ~]$ cat testfile && stat testfile
text
  File: testfile
  Size: 5         	Blocks: 8          IO Block: 4096   regular file
Device: 0,41	Inode: 7657366     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    user)   Gid: ( 1000/    user)
Access: 2022-04-30 15:45:19.182187755 +0200
Modify: 2022-04-30 15:45:19.182187755 +0200
Change: 2022-04-30 15:45:19.182187755 +0200
 Birth: 2022-04-30 15:42:59.824381806 +0200

But this is because of noatime:

/dev/sda5 on /home type btrfs (rw,noatime,compress=zstd:3,ssd,nospace_cache,commit=120,subvolid=257,subvol=/@home)
2 Likes

Hello, thank you :grinning:

Good question, but as I said, I don’t know what’s going on with my Manjaro xfce system. The only thing I know about this is that when I open/access a file, the system overwrites all the metadata of the file to put that access date in all the metadata of that same file, which removes the creation date, etc. Exactly like this:

I hope to be clear.

Edit: I just saw that you added some new stuff to your comment, I’ll read them :slight_smile: .

Thanks a lot, it’s getting clearer and clearer!
So I did all the command lines you gave me and I get exactly the same thing as you, it’s positive. I also took the opportunity to do exactly the same thing but with Mousepad and Libreoffice and I realize that they are the ones that cause the problem of my original message of this topic; that is to say, to make it short, that it also changes the creation date of the file compared to the modification date; so when I modify a text file, it will change the creation date when it was a simple modification (exactly like the Stat command of my first message). So, I don’t think that noatime is the problem because it simply acts on the access times to the files but simply Mousepad and Libreoffice? If it is two text applications that are the problem, is there a solution? Because I would like to keep the real date of creation of the file and not that it is replaced by the date of modification as I already said before.
Finally, thanks to these tests, I have the impression that the problem is not as serious as I thought, which means that we can exclude the fault or absence of applications such as: fs.inotify, watchman, iwatch, etc.; because if it was their fault, your test would not have worked, right? What do you think?
Thank you!

Do you use Save when modifying a file or do you use Save As and overwrite the modified file?

I just use “Save” because I know that “Save As” will overwrite the existing file .

Yep that is not the problem…

Well I never actually use the stats, but I tried gedit and it is like you said: When saving a file, it will always overwrite it and reset all dates to the current time.

If I edit a file with nano, it only updates the Modify and Change date as expected

So I assume it is because the application recreates the file on save.

  1. Changing the file with nano:
[user@manjaro ~]$ stat testfile 
  File: testfile
  Size: 12        	Blocks: 8          IO Block: 4096   regular file
Device: 0,41	Inode: 7693715     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    user)   Gid: ( 1000/    user)
Access: 2022-05-01 18:21:23.296553900 +0200
Modify: 2022-05-01 18:21:23.303220629 +0200
Change: 2022-05-01 18:21:23.306553992 +0200
 Birth: 2022-05-01 18:21:23.296553900 +0200
[user@manjaro ~]$ nano testfile 
[user@manjaro ~]$ stat testfile 
  File: testfile
  Size: 18        	Blocks: 8          IO Block: 4096   regular file
Device: 0,41	Inode: 7693715     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    user)   Gid: ( 1000/    user)
Access: 2022-05-01 18:21:23.296553900 +0200
Modify: 2022-05-01 18:22:10.440321859 +0200
Change: 2022-05-01 18:22:10.440321859 +0200
 Birth: 2022-05-01 18:21:23.296553900 +0200

Inode is the same: 7693715

  1. Editing the file with gedit:
[user@manjaro ~]$ gedit testfile
[user@manjaro ~]$ stat testfile 
  File: testfile
  Size: 23        	Blocks: 8          IO Block: 4096   regular file
Device: 0,41	Inode: 7693928     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    user)   Gid: ( 1000/    user)
Access: 2022-05-01 18:29:09.637518901 +0200
Modify: 2022-05-01 18:29:09.640852264 +0200
Change: 2022-05-01 18:29:09.650852356 +0200
 Birth: 2022-05-01 18:29:09.637518901 +0200

Inode changes: 7693715 → 7693928

So gedit creates a new file. It doesn’t matter if you click on save or save as.

No idea if it is indented to work that way, but it is clearly a question to the devs of the program. Why they ignore the stats and recreate/overwrite files.

1 Like

Maybe reach the respective devs through their forum / bug tracker?

1 Like

What is surprising is that the problem is present on three text editors (Libreoffice, Mousepad, Gedit) and maybe on others that we have not tested.

Installed and tried kate now:

[user@manjaro ~]$ stat testfile 
  File: testfile
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 0,41	Inode: 7695601     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    user)   Gid: ( 1000/    user)
Access: 2022-05-01 19:07:42.882286844 +0200
Modify: 2022-05-01 19:07:42.882286844 +0200
Change: 2022-05-01 19:07:42.882286844 +0200
 Birth: 2022-05-01 19:07:38.748915324 +0200
[user@manjaro ~]$ kate testfile 
kf.service.services: The desktop entry file "/usr/share/applications/org.gnome.ChromeGnomeShell.desktop" has Type= "Application" but no Exec line
kf.service.sycoca: Invalid Service :  "/usr/share/applications/org.gnome.ChromeGnomeShell.desktop"
kf.service.services: The desktop entry file "/usr/share/applications/qemu.desktop" has Type= "Application" but no Exec line
kf.service.sycoca: Invalid Service :  "/usr/share/applications/qemu.desktop"
kf.sonnet.core: No language dictionaries for the language: "C" trying to load en_US as default
kf.kio.core: The recently-used.xbel is not an XBEL file, overwriting.
kf.kio.core: The recently-used.xbel is not an XBEL file, overwriting.
kf.kio.core: The recently-used.xbel is not an XBEL file, overwriting.
[user@manjaro ~]$ stat testfile
  File: testfile
  Size: 5         	Blocks: 8          IO Block: 4096   regular file
Device: 0,41	Inode: 7695601     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    user)   Gid: ( 1000/    user)
Access: 2022-05-01 19:07:42.882286844 +0200
Modify: 2022-05-01 19:08:08.725859009 +0200
Change: 2022-05-01 19:08:08.725859009 +0200
 Birth: 2022-05-01 19:07:38.748915324 +0200

An well, what should I say. It works as expected like in nano.

What they all have in common: They use the GTK framework, but Kate uses the QT Framework. So that must be a trace.

So more specific, it must be:

QT → kio
GTK → gio

2 Likes

Maybe, it is possible, or it can also be a coincidence… Weird…
So, I think we can’t do anything more for the moment?

For LibreOffice, not exactly.

LibreOffice includes support for GTK and Qt theme integration. See also Uniform look for Qt and GTK applications.

LibreOffice will try to autodetect the most suitable VCL UI interface based on your desktop environment. To force the use of a certain VCL UI interface, use one of the SAL_USE_VCLPLUGIN=gen, SAL_USE_VCLPLUGIN=gtk3, or SAL_USE_VCLPLUGIN=kf5 environment variables. These variables can be uncommented in /etc/profile.d/libreoffice-fresh.sh or /etc/profile.d/libreoffice-still.sh. See vcl/README.md for more information.
LibreOffice - ArchWiki

Though i say this, i am using KDE lately, and i do see that all metadata are modified when using LibreOffice. But is switched from Xfce this week, so i don’t know if there is a leftover or something…

2 Likes

It also affects pluma, mate’s text editor.

I’ve noticed many strange time stamp inconsistencies. Some files are modified weeks before they are created. Others I know I created over six months ago show as new. Nothing can be trusted.

  • If I copy files from a device (gopro, bike computer) it always sets modify +1hr in the future of when the file was saved on the device.

  • If I use Nautilus, right-click New Document > Empty file, the modify will be -2hrs in the past.

  • if I edit a file (gedit) then ALL access, modify, change, birth all get set to current time.

I am using Gnome. Manjaro 21.2.6

EXAMPLE: This text file has been sitting around for a month or two untouched.

    ~  stat '/home/rico/Desktop/house_Q.txt'                           
  File: /home/rico/Desktop/house_Q.txt
  Size: 377       	Blocks: 8          IO Block: 4096   regular file
Device: 8,1	Inode: 12718943    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    rico)   Gid: ( 1001/    rico)
Access: 2022-05-02 14:41:04.442360421 +0100
Modify: 2022-02-22 21:17:14.868927000 +0000
Change: 2022-03-06 22:11:47.798750237 +0000
 Birth: 2022-03-06 22:11:47.792083579 +0000

Edit file in gedit, then :

    ~  stat '/home/rico/Desktop/house_Q.txt'                            
  File: /home/rico/Desktop/house_Q.txt
  Size: 378       	Blocks: 8          IO Block: 4096   regular file
Device: 8,1	Inode: 12724190    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/    rico)   Gid: ( 1001/    rico)
Access: 2022-05-02 14:41:18.992693619 +0100
Modify: 2022-05-02 14:41:18.992693619 +0100
Change: 2022-05-02 14:41:19.002693848 +0100
 Birth: 2022-05-02 14:41:18.992693619 +0100

1 Like

@Thanks

I found here an issue for gedit and it explains it:

In general the behavior is the following:

  1. When opening a file, it creates a temp file, which records all changes on the fly.
  2. When saving, it deletes the old file and renames it to the original file.

In my eyes it is a bug when metadata gets deleted that way, but seems the devs don’t mind.

15 years ago there was a fix in Gedit 2.14: [gedit-list] Gedit and Hard Links but it seems it was reverted?

4 Likes

@megavolt That must be it!
Unfortunately the new Gnome42 “Text Editor” has the same issue.

Thank you very much for this research. I don’t know what to say, on the one hand it seems to be intentional but on the other hand not really… What also gives me the impression that it’s intentional is that several editors have exactly the same problem/bug (because yes, for me too, it’s a problem/bug); but then, why don’t command line editors have this problem/bug… But one thing is sure, robots with a conscience, it’s not for 2022… xD I’m teasing, of course, I respect the devs and thank them for their work!

It may be worth it, other communities may want to find a solution, because it’s not possible to stay in this situation. But it will be difficult for me, I don’t have enough time… Sorry.

It’s worrying, I haven’t tested this so I can’t confirm but it’s also something to look into.