Modification date of new binaries

,

This might have a trivial answer but I’m drawing a blank right now.

If I create a new file, it looks like this:

$ stat hello
  File: hello
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 253,1   Inode: 97004834    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/user)   Gid: ( 1000/user)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2024-09-13 10:08:51.449305258 -0700
Modify: 2024-09-13 10:08:51.449305258 -0700
Change: 2024-09-13 10:08:51.449305258 -0700
 Birth: 2024-09-13 10:08:51.449305258 -0700

Notice all timestamps are the same.

But when dnf is upgrading a package, a file that it installs looks like this:

$ stat /usr/bin/clang-18
  File: /usr/bin/clang-18
  Size: 144648          Blocks: 288        IO Block: 4096   regular file
Device: 253,1   Inode: 51132576    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Context: system_u:object_r:bin_t:s0
Access: 2024-09-13 10:03:39.412761176 -0700
Modify: 2024-07-10 21:00:00.000000000 -0700 <<<<
Change: 2024-09-13 10:02:33.298124457 -0700
 Birth: 2024-09-13 10:02:33.295124469 -0700

Notice the modification timestamp is different.

This is the package that installed it:

$ grep clang-18.1.8 /var/log/dnf.log
2024-09-13T10:04:19-0300 DEBUG Upgraded: clang-18.1.8-1.fc40.x86_64

$ rpm -qi clang
Name        : clang
Version     : 18.1.8
Release     : 1.fc40
Architecture: x86_64
Install Date: Fri 13 Sep 2024 10:02:33 AM -07
Group       : Unspecified
Size        : 601816
License     : Apache-2.0 WITH LLVM-exception OR NCSA
Signature   : RSA/SHA256, Sat 31 Aug 2024 11:32:54 AM -07, Key ID 0727707ea15b79cc
Source RPM  : clang-18.1.8-1.fc40.src.rpm
Build Date  : Thu 15 Aug 2024 03:39:00 PM -07
Build Host  : buildhw-x86-08.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://llvm.org
Bug URL     : https://bugz.fedoraproject.org/clang
Summary     : A C language family front-end for LLVM

What gives? I may need more coffee :slight_smile:

This may explain it:

With enough permissions, the modification and access time can be set to any value, but nut the change time. If you set any of the other time stamps, the change time will be set to the current time.

When restoring files from an archive, it is common that the modification time will be set to the value stored in the archive.

The change time is the time when any meta-data is changed such as file size, modification time, link count, etc. Changing the contents of a file doesn’t change the meta-data, except when the file size is also changed.

See man touch for a program which can set the modification time of a file.