WineHQ
Bug Tracking Database – Bug 31237

 Bugzilla

 

Last modified: 2013-12-02 14:50:13 CST  

libfaketime: integrate with libfaketime to allow running a program with a fake system time

Bug 31237 - libfaketime: integrate with libfaketime to allow running a program with a fake system time
libfaketime: integrate with libfaketime to allow running a program with a fak...
Status: UNCONFIRMED
AppDB: Show Apps affected by this bug
Product: Wine
Classification: Unclassified
Component: -unknown
1.6
x86 Linux
: P2 enhancement
: ---
Assigned To: Mr. Bugs
: download, source
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-07-18 04:59 CDT by alister.hood
Modified: 2013-12-02 14:50 CST (History)
2 users (show)

See Also:
Regression SHA1:
Fixed by SHA1:
Distribution: ---
Staged patchset:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alister.hood 2012-07-18 04:59:59 CDT
Like Wine, faketime is another lib/application that is useful for running legacy programs, for example those which can no longer run because of the "millenium bug".  It lets you present a fake system time to a program.

It would be nice if the functionality of libfaketime could be integrated with Wine.

The faketime executable and Wine do not cooperate well.  Some programs such as winecfg and notepad work well, but when you try to run other programs (e.g. Excel 2007 which was one I tried) they crash, and then any subsequent programs you try to run also crash, even programs which worked fine before running Excel or whatever the problem program was:

# faketime '2006-09-20' winecfg
wine: Unhandled page fault on read access to 0x00000000 at address (nil) (thread 001d), starting debugger...

Some Wine programs do actually run fine apart from outputting this error, but others crash properly.

I reported this to the faketime developer, and this was his reply:

> Basically, libfaketime has clear limitations when it comes to programs
> that spawn child processes due to the LD_PRELOAD design. Wine probably
> starts a lot of sub-programs, and since only the parent process is tricked
> into seeing the faked time, but the spawned child processes get access to
> the real wall clock time, this inconsistency might lead to this page fault
> crash.
> 
> As of today, we have undertaken several steps to make libfaketime capable
> of supporting spawned child processes (at least on Linux), but we're not
> quite there yet. Some problems we ran into so far are still K.O. criteria,
> so I can't promise any delivery date right now.
> 
> However, libfaketime can be integrated into other programs quite easily,
> so if the Wine developers would use it in their Wine source, faking the
> time for any Wine-executed program would be quite trivial and without all
> those sub-process hassles. However, I don't know whether the Wine guys
> would be interested in such an option

So, are "the Wine guys" interesting in integrating libfaketime with Wine?

FYI here's a link:
http://www.code-wizards.com/projects/libfaketime/index.html
Comment 1 Alexandre Julliard 2012-07-18 05:17:39 CDT
To do it right you'd need to ensure that all processes running under the same wineserver see the same time, so even tracking child processes wouldn't be sufficient. It would need a convincing use case to be worth the effort.
Comment 2 Austin English 2012-07-18 13:54:53 CDT
You could use RunAsDate: http://www.nirsoft.net/utils/run_as_date.html

works in wine, since 1.3.30: http://bugs.winehq.org/show_bug.cgi?id=19975
Comment 3 alister.hood 2012-07-18 20:18:04 CDT
(In reply to comment #1)
> To do it right you'd need to ensure that all processes running under the same
> wineserver see the same time, so even tracking child processes wouldn't be
> sufficient. It would need a convincing use case to be worth the effort.

So that sounds like you would be open to patches, anyway.  Is that right?

Is there any guidance on what might make a "convincing use case"?
There are a lot of use cases, but they do tend to be pretty niche.
Another example is for testing a program e.g. to see if it handles expired certificates correctly, or if it works correctly on a leap day.

BTW I've just been reminded that as well as faketime, there is an alternative called datefudge, although last I heard it was missing some of the functionality of datetime.  I'll need to test the datefudge executable with Wine on the weekend, but I imagine it will have similar issues.

(In reply to comment #2)
> You could use RunAsDate: http://www.nirsoft.net/utils/run_as_date.html
> 
> works in wine, since 1.3.30: http://bugs.winehq.org/show_bug.cgi?id=19975

There are cases where RunAsDate doesn't work, and I suspect that a faketime implementation in Wine would not have the same limitations (But I don't really know how Wine works, so I can't say for sure).
Comment 4 Alexandre Julliard 2012-07-19 05:15:09 CDT
(In reply to comment #3)
> (In reply to comment #1)
> > To do it right you'd need to ensure that all processes running under the same
> > wineserver see the same time, so even tracking child processes wouldn't be
> > sufficient. It would need a convincing use case to be worth the effort.
> 
> So that sounds like you would be open to patches, anyway.  Is that right?
> 
> Is there any guidance on what might make a "convincing use case"?
> There are a lot of use cases, but they do tend to be pretty niche.
> Another example is for testing a program e.g. to see if it handles expired
> certificates correctly, or if it works correctly on a leap day.

That sort of niche use case can be handled by maintaining a separate patch that you apply for testing. I wouldn't consider it important enough to justify adding the feature to the main code base.
Comment 5 alister.hood 2012-07-20 06:40:41 CDT
OK, thanks for the replies.

For the record, the same problem does occur using wine with the datefudge executable as occurs with the faketime executable.
Comment 6 Erinn Clark 2013-11-28 19:25:18 CST
Hi there!

I think I may have a convincing use case for adding this feature. I work for the Tor Project and we've recently been doing a lot of work on making our builds deterministic[1][2]. Currently we're trying to use Wine for some Python stuff but we can't get libfaketime to work with it, no matter what kinds of wrappers we write or what kind of LD_PRELOAD magic we invoke. (If you want some more background on this, there is a long comment here, just look for libfaketime: https://trac.torproject.org/projects/tor/ticket/9444#comment:20)

Is there anything we can do to help make this happen?

[1] https://blog.torproject.org/blog/deterministic-builds-part-one-cyberwar-and-global-compromise
[2] https://blog.torproject.org/blog/deterministic-builds-part-two-technical-details


Privacy Policy
If you have a privacy inquiry regarding this site, please write to privacy@winehq.org

Hosted By CodeWeavers