faketime doesn't fake stat(1) or ls(1) timestamps after Ubuntu 20.10

Bug #2052986 reported by Dalton Durst
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
faketime (Debian)
New
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=/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 Ubuntu 20.04, or with faketime built from current git master, the correct result is 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: 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://github.com/wolfcw/libfaketime/issues/417 which was fixed by PR https://github.com/wolfcw/libfaketime/pull/434

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.

Tags: patch
Revision history for this message
Dalton Durst (universalsuperbox) wrote :

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
    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/dpkg/status
      0.9.10-2.1 500
          500 http://ports.ubuntu.com/ubuntu-ports noble/universe arm64 Packages

Revision history for this message
Erich Eickmeyer (eeickmeyer) wrote :

LGTM, sponsoring.

Changed in faketime (Ubuntu):
assignee: nobody → Erich Eickmeyer (eeickmeyer)
importance: Undecided → Medium
milestone: none → ubuntu-24.04-feature-freeze
status: New → In Progress
status: In Progress → Fix Committed
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "faketime-add-statx.debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Changed in faketime (Debian):
status: Unknown → New
Revision history for this message
Lukas Märdian (slyon) wrote :

This already got sponsored: https://launchpad.net/ubuntu/+source/faketime/0.9.10-2.1ubuntu1

So I'm unsubscribing ~ubuntu-sponsors.

I see there are some build-failures for armhf/i386. If further uploads are needed, please re-subscribe ubuntu-sponsors.

Changed in faketime (Ubuntu):
milestone: ubuntu-24.04-feature-freeze → ubuntu-24.04-beta
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.