#1063820 faketime does not fake timestamps in stat(1) or ls(1)

Package:
faketime
Source:
faketime
Description:
Report faked system time to programs (command-line tool)
Submitter:
Dalton Durst
Date:
2025-01-17 13:36:02 UTC
Severity:
normal
Tags:
#1063820#5
Date:
2024-02-13 00:46:54 UTC
From:
To:
Dear Maintainer,

faketime and libfaketime in and after Debian 11 (bullseye) do not fake
timestamps to common commands which use the statx syscall, such as
stat(1) or ls(1). Instead, the on-disk timestamps are returned:

  # LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1 FAKETIME='1970-01-01 00:00:01' stat /
    File: /
    Size: 4096 Blocks: 8 IO Block: 4096 directory
  Device: 72h/114d Inode: 14475976 Links: 1
  Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
  Access: 2024-02-13 00:08:45.027068497 +0000
  Modify: 2024-02-13 00:08:45.027068497 +0000
  Change: 2024-02-13 00:09:55.450105641 +0000
  Birth: 2024-02-13 00:08:45.027068497 +0000

In Debian 10 (buster) and earlier, or in sid with faketime built from
the current git master branch, the correct result is returned (all
timestamps are returned as 1970-01-01 00:00:01.0). This seems to be
related to upstream bug https://github.com/wolfcw/libfaketime/issues/417
which was fixed by PR https://github.com/wolfcw/libfaketime/pull/434

Unfortunately, faketime hasn't had a release since that fix for statx
was merged.

#1063820#10
Date:
2024-10-31 07:52:36 UTC
From:
To:
Control: forwarded -1 https://github.com/wolfcw/libfaketime/issues/417
Control: tags -1 patch
Lets tag it like that.

Paul

#1063820#21
Date:
2025-01-12 22:57:49 UTC
From:
To:
Hi.

I am preparing an upload for faketime to fix the 32-bit failures.  I
saw this bug and thought I would try to include this fix.

I used `git-cherry-pick 942b30e9400d50cc95b19b7fb3d81c2def1f984a`
to collect the commit from upstream MR !434.  But in my tests, it
didn't work:

$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1 FAKETIME='1970-01-01 00:00:01' stat /
  File: /
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 253,1   Inode: 2           Links: 21
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2025-01-12 13:27:32.703730337 +0000
Modify: 2025-01-03 11:10:14.883276558 +0000
Change: 2025-01-03 11:10:14.883276558 +0000
 Birth: 2024-09-16 18:46:34.000000000 +0100

I don't know why this is but perhaps there's a statx64 or something?
I haven't investigated further.

One approach I didn't investigate was to try upstream unreleased
mainline.  If we did that we'd probably want to review quite carefully
what we were shipping.  I don't think this is suitable for the NMU I
am now preparing.

Anyway, thanks for the contribution, and sorry not to be including
this fix.

Ian.

#1063820#26
Date:
2025-01-17 13:34:04 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
faketime, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1063820@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Ian Jackson <ijackson@chiark.greenend.org.uk> (supplier of updated faketime package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Fri, 17 Jan 2025 13:17:41 +0000
Source: faketime
Architecture: source
Version: 0.9.10+2024-06-05+gba9ed5b2-0.1
Distribution: unstable
Urgency: medium
Maintainer: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Changed-By: Ian Jackson <ijackson@chiark.greenend.org.uk>
Closes: 1063820 1093153
Changes:
 faketime (0.9.10+2024-06-05+gba9ed5b2-0.1) unstable; urgency=medium
 .
   * Non-maintainer upload.
   * Update to new upstream version from unreleased git, ba9ed5b2898f234c.
     Fixes stat(1) and ls(1).  Closes: #1063820.  [Report from Dalton Durst]
   * Interpose __time64 too, to fix 32-bit platforms.
     Closes: #1093153.  [Assistance from Olly Betts]
   * Interpose gettimeofday64 too.
   * Add an autopkgtest for a normally-built C program.
Checksums-Sha1:
 1785a3244be9b3308462f5c73762e0de19da54ff 1900 faketime_0.9.10+2024-06-05+gba9ed5b2-0.1.dsc
 54c40ebf325609ea3a7a242ed7bea0df9c1f961e 76744 faketime_0.9.10+2024-06-05+gba9ed5b2.orig.tar.xz
 04017ccaff2592925d5a7114c23b688df8cc3bfd 9200 faketime_0.9.10+2024-06-05+gba9ed5b2-0.1.debian.tar.xz
Checksums-Sha256:
 4a8898b20fada0eeee2c990d7c504fcef13f6dc00897139f5ee3471e682dba65 1900 faketime_0.9.10+2024-06-05+gba9ed5b2-0.1.dsc
 879597d9b3469b062314dbac70b2dd3b393053086772999ed94401b8ddb412de 76744 faketime_0.9.10+2024-06-05+gba9ed5b2.orig.tar.xz
 7c2d4cf96463d3342358bd9353541fb9b7ab074e288327176465b2d8b63c3dc3 9200 faketime_0.9.10+2024-06-05+gba9ed5b2-0.1.debian.tar.xz
Files:
 1e719f15d3067c923a6384c509e16323 1900 utils optional faketime_0.9.10+2024-06-05+gba9ed5b2-0.1.dsc
 dcf84600f6deb93b3eef1d51942f9d3a 76744 utils optional faketime_0.9.10+2024-06-05+gba9ed5b2.orig.tar.xz
 b4640d68cc8e6cf8a031adebbdf5414c 9200 utils optional faketime_0.9.10+2024-06-05+gba9ed5b2-0.1.debian.tar.xz
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEVZrkbC1rbTJl58uh4+M5I0i1DTkFAmeKWRcACgkQ4+M5I0i1
DTk1kAgAt64OxFw5Ktr53+xYo/emYFyNddIYif/WTgJKgK1NDi3i1ULuYxeRqbQl
vhLJxrgef5RE67/6gFguYQbE2sKo3DZKC61XFS0m4gUUqWhTSlrnv5ry3V2g5219
NkdeCIxWSLH0KPz/ZhkjuXZaOjA3+8PTModNV3q9/GIK1cFXl5jxW9K8Lr2thYo4
vsjTxwLpq32vCwle/jNbAsWvEikc/39ZQkgAw4u0dsuNIyxwGgU9/VlGibnhzfSg
qPdOa9SNbFD+5cmntiHe080UwDDQfOIddV9OCPN87Q0FqdVK9T6Pkvw5oRtH0YAw
DI82VET/gzy8RcMFEpnt7c+T+l7KLw==
=RQLm
-----END PGP SIGNATURE-----