extract: discharge dependency from timer session

This patch removes the reliance of the extract tool from the libc's
behavior regarding the access of time and timing.

The extract tool is not expected to need time. However, unfortunately,
libarchive calls the 'time' function unconditionally. By adding a
dummy for 'time', we avoid bothering the libc, which would otherwise
need to obtain a time source.

Issue #3204
This commit is contained in:
Norman Feske 2019-04-05 14:13:38 +02:00 committed by Christian Helmuth
parent 6d11591d83
commit 9e238d624e
2 changed files with 16 additions and 2 deletions

View File

@ -18,7 +18,7 @@ install_config {
<start name="extract" caps="200">
<resource name="RAM" quantum="12M"/>
<config verbose="yes">
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/null"/>
<libc stdout="/dev/log" stderr="/dev/log"/>
<vfs>
<dir name="archived">
<rom name="test.tar.xz"/>

View File

@ -291,6 +291,20 @@ void Libc::Component::construct(Libc::Env &env)
static Extract::Main main(env);
}
/* dummy to prevent warning printed by unimplemented libc function */
/**
* Dummy to prevent warning printed by unimplemented libc function
*/
extern "C" mode_t umask(mode_t value) { return value; }
/**
* Dummy to discharge the dependency from a timer session
*
* When libarchive creates a archives, it requests the current time to create
* up-to-date time stamps. Unfortunately, however, 'time' is called
* unconditionally regardless of whether an archive is created or extracted.
* In the latter (our) case, the wall-clock time is not relevant. Still,
* libarchive creates an artificial dependency from a time source in either
* case.
*/
extern "C" time_t time(time_t *) { return 0; }