faketime doesn't fake stat(1) or ls(1) timestamps after Ubuntu 20.10
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
faketime (Debian) |
Fix Released
|
Unknown
|
|||
faketime (Ubuntu) |
Fix Committed
|
Medium
|
Erich Eickmeyer |
Bug Description
In all versions of Ubuntu including and after 20.10 (groovy) (including 22.04, 23.10, and the current devel release noble), the 'faketime' package fails to correctly fake timestamps for core commands like 'stat' and 'ls'. Instead, the on-disk timestamps are returned:
# LD_PRELOAD=
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 Ubuntu 20.04, or with faketime built from current git master, the correct result is returned:
# LD_PRELOAD=
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: 1970-01-01 00:00:01.000000000 +0000
Modify: 1970-01-01 00:00:01.000000000 +0000
Change: 1970-01-01 00:00:01.000000000 +0000
Birth: -
This seems to be related to upstream bug https:/
Ubuntu directly followed Debian with this bug, it was introduced in Debian's bullseye (11) release, with the same command working in buster (10).
Unfortunately, faketime hasn't had a release since the fix for statx was merged, so Debian hasn't noticed either.
Changed in faketime (Debian): | |
status: | Unknown → New |
Changed in faketime (Ubuntu): | |
milestone: | ubuntu-24.04-feature-freeze → ubuntu-24.04-beta |
Changed in faketime (Debian): | |
status: | New → Confirmed |
Changed in faketime (Debian): | |
status: | Confirmed → Fix Released |
I've attached a patch which backports the upstream commit 942b30e9 to noble, with included changelog (you'll probably need to mangle further since I'm not the uploader, but I tried). This change builds successfully (with dh_auto_test) and works on amd64 and arm64.
I also tested various commands from the faketime manpage and all returned as appropriate. I won't bore you with them here.
$ faketime -f '1970-01-01 00:00:01' stat Makefile dpkg/status ports.ubuntu. com/ubuntu- ports noble/universe arm64 Packages
File: Makefile
Size: 1006 Blocks: 8 IO Block: 4096 regular file
Device: 0,57 Inode: 2251351 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 1970-01-01 00:00:01.000000000 +0000
Modify: 1970-01-01 00:00:01.000000000 +0000
Change: 1970-01-01 00:00:01.000000000 +0000
Birth: 1970-01-01 00:00:01.000000000 +0000
$ faketime -f '1970-01-01 00:00:01' date -R
Thu, 01 Jan 1970 00:00:01 +0000
$ apt policy faketime
faketime:
Installed: 0.9.10-2.1ubuntu1
Candidate: 0.9.10-2.1ubuntu1
Version table:
*** 0.9.10-2.1ubuntu1 100
100 /var/lib/
0.9.10-2.1 500
500 http://