Revert "libfaketime fails to build from source: https://bugzilla.redhat.com/show_bug.cgi?id=1675271"

This reverts commit 9697d9a865.

References: https://pagure.io/releng/issue/8623
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2019-08-12 18:46:20 +02:00
parent 9697d9a865
commit cc17798916
No known key found for this signature in database
GPG Key ID: 695714BD1BBC5F4C
6 changed files with 173 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/libfaketime-0.9.6.tar.gz

View File

@ -1 +0,0 @@
libfaketime fails to build from source: https://bugzilla.redhat.com/show_bug.cgi?id=1675271

View File

@ -0,0 +1,13 @@
diff --git a/src/libfaketime.c b/src/libfaketime.c
index 3ec372b..f70283b 100644
--- a/src/libfaketime.c
+++ b/src/libfaketime.c
@@ -1380,7 +1380,7 @@ void __attribute__ ((constructor)) ftpl_init(void)
real_clock_get_time = dlsym(RTLD_NEXT, "clock_get_time");
real_clock_gettime = apple_clock_gettime;
#else
- real_clock_gettime = dlsym(RTLD_NEXT, "clock_gettime");
+ real_clock_gettime = dlsym(RTLD_NEXT, "__clock_gettime");
#ifdef FAKE_TIMERS
real_timer_settime_22 = dlvsym(RTLD_NEXT, "timer_settime","GLIBC_2.2");
real_timer_settime_233 = dlvsym(RTLD_NEXT, "timer_settime","GLIBC_2.3.3");

View File

@ -0,0 +1,64 @@
From 628c70a67a94b3020cab79171545721dfd295fcd Mon Sep 17 00:00:00 2001
From: Mario Pareja <pareja.mario@gmail.com>
Date: Fri, 9 Jan 2015 18:15:53 +0000
Subject: [PATCH] Begin adding CLOCK_BOOTTIME support.
---
src/faketime_common.h | 2 ++
src/libfaketime.c | 9 ++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/faketime_common.h b/src/faketime_common.h
index ee0d627..7de6cd8 100644
--- a/src/faketime_common.h
+++ b/src/faketime_common.h
@@ -32,6 +32,8 @@ struct system_time_s
struct timespec mon;
/* System time according to CLOCK_MONOTONIC_RAW */
struct timespec mon_raw;
+ /* System time according to CLOCK_BOOTTIME */
+ struct timespec boot;
};
/* Data shared among faketime-spawned processes */
diff --git a/src/libfaketime.c b/src/libfaketime.c
index f4a26be..121bbf6 100644
--- a/src/libfaketime.c
+++ b/src/libfaketime.c
@@ -208,7 +208,7 @@ static int cache_duration = 10; /* cache fake time input for 10 seconds */
* Static timespec to store our startup time, followed by a load-time library
* initialization declaration.
*/
-static struct system_time_s ftpl_starttime = {{0, -1}, {0, -1}, {0, -1}};
+static struct system_time_s ftpl_starttime = {{0, -1}, {0, -1}, {0, -1}, {0, -1}};
static char user_faked_time_fmt[BUFSIZ] = {0};
@@ -319,6 +319,7 @@ static void system_time_from_system (struct system_time_s * systime)
DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_REALTIME, &systime->real));
DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_MONOTONIC, &systime->mon));
DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_MONOTONIC_RAW, &systime->mon_raw));
+ DONT_FAKE_TIME((*real_clock_gettime)(CLOCK_BOOTTIME, &systime->boot));
#endif
}
@@ -1834,6 +1835,9 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp)
case CLOCK_MONOTONIC_RAW:
timespecsub(tp, &ftpl_starttime.mon_raw, &tmp_ts);
break;
+ case CLOCK_BOOTTIME:
+ timespecsub(tp, &ftpl_starttime.boot, &tmp_ts);
+ break;
default:
printf("Invalid clock_id for clock_gettime: %d", clk_id);
exit(EXIT_FAILURE);
@@ -1973,6 +1977,9 @@ int fake_clock_gettime(clockid_t clk_id, struct timespec *tp)
case CLOCK_MONOTONIC_RAW:
timespecsub(tp, &ftpl_starttime.mon_raw, &tdiff);
break;
+ case CLOCK_BOOTTIME:
+ timespecsub(tp, &ftpl_starttime.boot, &tdiff);
+ break;
default:
printf("Invalid clock_id for clock_gettime: %d", clk_id);
exit(EXIT_FAILURE);

94
libfaketime.spec Normal file
View File

@ -0,0 +1,94 @@
Summary: Manipulate system time per process for testing purposes
Name: libfaketime
Version: 0.9.6
Release: 10%{?dist}
License: GPLv2+
Url: http://www.code-wizards.com/projects/libfaketime/
Source: http://www.code-wizards.com/projects/%{name}/%{name}-%{version}.tar.gz
Patch1: libfaketime-0.9.5-fix-infinite-recursion-on-real_clock_gettime.patch
Patch2: libfaketime-0.9.6-boottime.patch
BuildRequires: gcc
%description
libfaketime intercepts various system calls which programs use to
retrieve the current date and time. It can then report faked dates and
times (as specified by you, the user) to these programs. This means you
can modify the system time a program sees without having to change the
time system- wide.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
# work around from upstream for autodetecting glibc version bug on i686
sed -i -e 's/__asm__(".symver timer_gettime_22/\/\/__asm__(".symver timer_gettime_22/' src/libfaketime.c
sed -i -e 's/__asm__(".symver timer_settime_22/\/\/__asm__(".symver timer_settime_22/' src/libfaketime.c
%build
cd src ; CFLAGS="%{optflags} -Wno-nonnull-compare -Wno-strict-aliasing" make %{?_smp_mflags} \
PREFIX="%{_prefix}" LIBDIRNAME="/%{_lib}/faketime" all
%check
make %{?_smp_mflags} -C test all
%install
make PREFIX="%{_prefix}" DESTDIR=%{buildroot} LIBDIRNAME="/%{_lib}/faketime" install
rm -r %{buildroot}/%{_docdir}/faketime
# needed for stripping/debug package
chmod a+rx %{buildroot}/%{_libdir}/faketime/*.so.*
%files
%{_bindir}/faketime
%dir %attr(0755, root, root) %{_libdir}/faketime/
%attr(0755, root, root) %{_libdir}/faketime/libfaketime*so.*
%doc README COPYING NEWS README README.developers
%{_mandir}/man1/*
%changelog
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.6-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.6-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.6-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.6-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.6-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Oct 12 2016 Paul Wouters <pwouters@redhat.com> - 0.9.6-4
- Add support for CLOCK_BOOTTIME (patch by Mario Pareja <pareja.mario@gmail.com>)
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Tue Oct 28 2014 Paul Wouters <pwouters@redhat.com> - 0.9.6-1
- Upgraded to 0.9.6 which adds option to disable monotonic time faking
- fix permissions for symbol stripping for debug package
* Tue Oct 15 2013 Paul Wouters <pwouters@redhat.com> - 0.9.5-4
- Infinite recursion patch is still needed, make test causes
segfaults otherwise.
* Mon Oct 14 2013 Paul Wouters <pwouters@redhat.com> - 0.9.5-3
- Work around from upstream for autodetecting glibc version bug on i686
* Mon Oct 14 2013 Paul Wouters <pwouters@redhat.com> - 0.9.5-2
- Remove use of ifarch for _lib macro for multilib
* Sun Oct 13 2013 Paul Wouters <pwouters@redhat.com> - 0.9.5-1
- Initial package

1
sources Normal file
View File

@ -0,0 +1 @@
f522f899d65a057ad69cff9896c75f78 libfaketime-0.9.6.tar.gz