wolfcw / libfaketime

libfaketime modifies the system time for a single application
https://github.com/wolfcw/libfaketime
GNU General Public License v2.0
2.71k stars 325 forks source link

faketime -f "@2021-06-23 12:00:00" tcsh freezes #336

Closed subssn594 closed 3 years ago

subssn594 commented 3 years ago

My command: faketime -f "@2021-06-23 12:00:00" tcsh

date;sleep 5;date Wed Jun 23 12:00:00 EDT 2021 Wed Jun 23 12:00:00 EDT 2021

Time freezes in the tcsh shell. Documentation says that this is a start time.

lsb_release -a LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch Distributor ID: Ubuntu Description: Ubuntu 18.04.5 LTS Release: 18.04 Codename: bionic

uname -a Linux eboy 4.15.0-144-generic #148-Ubuntu SMP Sat May 8 02:33:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

wolfcw commented 3 years ago

Please try with FAKETIME_DONT_RESET=1 set as described in section 4c of the README, this part:

https://github.com/wolfcw/libfaketime/blob/9a73db074b2ec47f0b336d7644309b354cf2b198/README#L230-L233

In my test environment, it then works as you probably expected:

$ FAKETIME_DONT_RESET=1 faketime -f "@2021-06-23 12:00:00" tcsh
debian:~> date;sleep 5;date
Wed 23 Jun 2021 12:00:06 PM CEST
Wed 23 Jun 2021 12:00:11 PM CEST
subssn594 commented 3 years ago

I tried it (running in tcsh):

env FAKETIME_DONT_RESET=1 faketime -f "@2021-06-23 12:00:00" tcsh date Wed Jun 23 12:00:00 EDT 2021 (same result with multiple tries) echo $FAKETIME_DONT_RESET 1

wolfcw commented 3 years ago

Are you sure you're using libfaketime v0.9.8 or more recent (FAKETIME_DONT_RESET was added there)? I'm unable to reproduce this. Not sure what Ubuntu 18.04.5 LTS currently ships, v0.9.8 was released in August 2019.

subssn594 commented 3 years ago

Apparently 18.04 has 0.9.7-2. If that's the issue, then I'll just use the -f '+5d' syntax. That option works fine.

wolfcw commented 3 years ago

Again, not sure what Ubuntu backported into 0.9.7-2, but that's most likely the problem. Using relative offsets works as well (without FAKETIME_DONT_RESET), otherwise you could try compiling from source.

subssn594 commented 3 years ago

It's interesting that the syntax I used did get the time right, but the clock froze. The other syntax "+5d", didn't freeze the clock.

Since this is an old issue, closing it is the right thing. Thanks for your attention.