New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intercept calls that change file timestamps #183
Comments
|
Yes, I can reproduce that problem. Could you please try
produces the desired output here, and using |
|
Using plain LD_PRELOAD lacks the other variable for shared memory required for the synchronized counter, so the two |
|
With 0c8905f, the following should work as expected:
|
to make the time jump +1 second each time it is queried Use the fix from wolfcw/libfaketime#183
to make the time jump +1 second each time it is queried Use the fix from wolfcw/libfaketime#183
to make the time jump +1 second each time it is queried Use the fix from wolfcw/libfaketime#183
|
This looks good to me. In my tests, stat output remains stable, except for slight sub-second variations (probably because the real clock is used for the touch call so it matters when that is done) Now I'm wondering, when the 0.9.8 release is planned. |
|
Thanks for testing! If everything else works out fine, the v0.9.8 release should be out before end of this month. |
|
I just discovered one downside: files that have constant time (e.g. extracted from a tarball) change time with different fake time date values. |
|
Yes, I see what you mean. But that's a somewhat fundamental problem... with Eventually we could add black-/whitelists of filenames for which the stats should be faked (similar to what is already implemented for process names) in a later version, but this wouldn't solve the problem for stat-before-touch files (unless we also have some "reverse limited stat faking" in analogy to the existing "limiting per process"). The basic goal here is some sort of repeatability / determinism. When it also should be "good looking", it might be worth the effort to "touch" the files to the right timestamp within the libfaketime environment before starting their processing. |
|
I could imagine, that one way would be to intercept write/close/utimensat/futimens calls and touch files in the filesystem to the faked time, so you do not have to track them yourself. |
|
Agreed - although pushing the faked time through to the file system will leave the "read only" characteristic (= all the faked times are limited to the one process running with libfaketime), which libfaketime has so far, behind. There's quite a queue of additional system calls that libfaketime should intercept, so I can't make any promises when this will be done. If you're interested in contributing or know someone, I'd be happy for any assistance. |
|
Apparently a lot more system calls trigger updates of the file's atime and must be considered when implementing this. Also, while atime and mtime can be set rather easily, faking the ctime seems to be challenging. Contributors wanted. :-) |
|
I've made a simple and dirty patch on utime() and utimes(), just for a simple application i used. |
|
@bmwiedemann I considered a similar situation for embedded builds but I think it won't work this way, because of concurrency:
I think this won't work well in practice, because the build process may create parallel processes and these may race for who calls some gettime first; depending on many aspects like number of cores, performance, load and who knows what else... @bmwiedemann Do you have an idea how to work around this? Binding everything on single core and avoid parallelism somehow? |
|
@bmwiedemann hello dear sorry for interpreting the convo ,i'm newbie ,i need little help i'm running opensuse tumbleweed under virtual machine i would like to know how I can manage to intercept time in firefox with libfaketime library would please list all commands to achieve that ,i struggled many time during a month with no result |
to make the time jump +1 second each time it is queried Use the fix from wolfcw/libfaketime#183
to make the time jump +1 second each time it is queried Use the fix from wolfcw/libfaketime#183
to make the time jump +1 second each time it is queried Use the fix from wolfcw/libfaketime#183
|
I'm afraid we haven't found anyone wanting to help on this within more than 3 years, so I'm closing this issue. Feel free to reopen if you can contribute. |
I am working on reproducible builds for openSUSE and there I would like to use libfaketime to make software behave exactly as if date+time were
i1param)e.g. I would like to use
faketime -f '@2020-01-01 01:01:01 i1'But one problem with stat is visible when you compare
That produces
With faketime, the stat results are shifting, when nothing touched the file, which can confuse programs like make.
The text was updated successfully, but these errors were encountered: