Dear Maintainer, I've tried to use faketime to build something reproducibly, by using the git commit time. Git offers shortcuts for the formats "iso" (e.g. "2019-09-06 03:14:37 +0200") and "iso-strict" (e.g. "2019-09-06T03:14:37+02:00"). Steps to reproduce, and actual behavior in bash: $ LC_ALL=C faketime -f "2019-09-06 03:14:37 02:00" true # "iso" [$? = 0] $ LC_ALL=C faketime -f "2019-09-06T03:14:37+02:00" true # "iso-strict" Failed to parse FAKETIME timestamp: Success [$? = 1] Expected behavior: Either the second invocation should "just work", or produce a more meaningful error message. I prefer the first behavior, and "Success" sounds like the parsing actually worked, just got handled wrongly, so maybe this can be done easily? For my little thing I'll just use git's "iso" shortcut. Cheers, Ben Wiederhake
Hi Ben, thanks for reporting this. Please be advised that a newer release is available upstream, which however likely is not related to your issue. With your calls, you should not use the '-f' parameter. Without '-f', the timestamp is passed on to date/gdate for parsing, which yields the following for me on Debian Buster x86_64: ./faketime '2019-09-06 03:14:37 02:00' /bin/date date: invalid date ‘2019-09-06 03:14:37 02:00’ Error: Timestamp to fake not recognized, please re-try with a different timestamp. ./faketime '2019-09-06T03:14:37+02:00' /bin/date Fri 06 Sep 2019 03:14:37 AM CEST So the "iso-strict" variant seems to work out of the box. When using '-f', the specified string is directly passed on to libfaketime by the 'faketime' wrapper without parsing (using date/gdate). In this case, you either have to stick to one of the formats that libfaketime expects (as documented in the README at https://github.com/wolfcw/libfaketime), or, which might be more appropriate for your case, you also have to set the FAKETIME_FMT environment variable. I hope that helps a bit. I also agree that "Success" isn't much of a useful error message here. In this case, it's created by a call to the standard perror() system call, which should be considered to be replaced with something more meaningful. I'll put that on the todo list. :-) However, more useful error messages are printed by the wrapper when '-f' is not used. Best regards Wolfgang Ben Wiederhake wrote on 08.09.19 20:54:
Hello Wolfgang, thanks for your quick response! time passing. In my case the call goes to a build process which takes several seconds, and the timestamp that I want to influence is taken at the very end of it. So without the '-f', the "fake clock" would show a non-deterministic, and most likely different, time. That's exactly the thing that I want to avoid. Thanks! I hoped that it could parse the absolute timestamp anyway, but 4b) is clear enough. Oh well. It does indeed, thank you. Like I already mentioned, in my case git's `iso` makes faketime happy, and makes me brush up my knowledge on bash. So in summary: - The parsing is "as intended". - git and faketime have different about "strict ISO date formats". - The bug is actually only the `: Success` part of the output. Therefore, the bug is only minor. Also, I have a manual workaround anyway. Cheers, Ben Wiederhake
Control: forwarded 939789 https://github.com/wolfcw/libfaketime/pull/368 Control: tags 939789 + patch I've proposed a patch (attached) for this, and forwarded it upstream, as this is still an issue on version 0.9.9 and even the upstream git master.
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 939789@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Daniel Kahn Gillmor <dkg@fifthhorseman.net> (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: Wed, 09 Mar 2022 10:47:30 -0500
Source: faketime
Architecture: source
Version: 0.9.10-1
Distribution: unstable
Urgency: medium
Maintainer: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Changed-By: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Closes: 939789
Changes:
faketime (0.9.10-1) unstable; urgency=medium
.
* new upstream release (no functional changes since previous git snapshot)
- Closes: #939789
* move to unstable
Checksums-Sha1:
3d6aa181f5ee8a9e0ccba8e870266ddb4abe29d6 1347 faketime_0.9.10-1.dsc
b2f660ca1aea0ef95b0f3f8e3304786df27c1fa7 88908 faketime_0.9.10.orig.tar.gz
1bab75680cb0d2b22630f9ec76b0fd32850235de 5880 faketime_0.9.10-1.debian.tar.xz
aff457a8126ee8f1e56d49899b9fa41dd642b7b0 7183 faketime_0.9.10-1_amd64.buildinfo
Checksums-Sha256:
7da437f3dc98cd7c073f7b7b9a68f8a6c76ad52c815635694cfa5b58ad525e1f 1347 faketime_0.9.10-1.dsc
729ad33b9c750a50d9c68e97b90499680a74afd1568d859c574c0fe56fe7947f 88908 faketime_0.9.10.orig.tar.gz
0083bc752d551ea09a7d8695bd68ed60b14768c3c9258008d89797e0c89dc75a 5880 faketime_0.9.10-1.debian.tar.xz
b6de1572b4574efc9d39a4469ccb8dc158eaf299d82e39019bb8549138878808 7183 faketime_0.9.10-1_amd64.buildinfo
Files:
1a0354686c70eb4233b8e24fea98816e 1347 utils optional faketime_0.9.10-1.dsc
bbeaa43f514fc8e637e5efdac53e2671 88908 utils optional faketime_0.9.10.orig.tar.gz
8cb2fbda80b07a38d9f74713394fb9b3 5880 utils optional faketime_0.9.10-1.debian.tar.xz
73dba9863cdf5932f0da6a131dd9c4e8 7183 utils optional faketime_0.9.10-1_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----
iHUEARYIAB0WIQQttUkcnfDcj0MoY88+nXFzcd5WXAUCYijNPwAKCRA+nXFzcd5W
XCGvAQDolsjDBLW6fiRwTtMauqNJnf+ywClGgDZtKaQKsuwh0QD/YcHJVamKe6JO
dLOtBLEnsW9mx/F2Z+qWa1C9sV0UJQc=
=abU0
-----END PGP SIGNATURE-----