From 44caf292ef6486fa148e38e5faff6fc51735f82f Mon Sep 17 00:00:00 2001 From: Warren Togami Date: Thu, 29 Aug 2019 11:15:14 -0700 Subject: [PATCH] - 0.9.8 - x86_64 EL7: DFORCE_MONOTONIC_FIX aarch64 EL7: DFORCE_MONOTONIC_FIX and FORCE_PTHREAD_NONVER ppc64le EL7: DFORCE_MONOTONIC_FIX and FORCE_PTHREAD_NONVER ppc64le F30+ FORCE_PTHREAD_NONVER --- .gitignore | 1 + ...nite-recursion-on-real_clock_gettime.patch | 13 ---- libfaketime-0.9.6-boottime.patch | 64 ------------------- libfaketime-0.9.8-FORCE_PTHREAD_NONVER.patch | 26 ++++++++ libfaketime.spec | 46 +++++++++---- sources | 2 +- 6 files changed, 62 insertions(+), 90 deletions(-) delete mode 100644 libfaketime-0.9.5-fix-infinite-recursion-on-real_clock_gettime.patch delete mode 100644 libfaketime-0.9.6-boottime.patch create mode 100644 libfaketime-0.9.8-FORCE_PTHREAD_NONVER.patch diff --git a/.gitignore b/.gitignore index 9034363..93a62bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /libfaketime-0.9.6.tar.gz +/libfaketime-0.9.8.tar.xz diff --git a/libfaketime-0.9.5-fix-infinite-recursion-on-real_clock_gettime.patch b/libfaketime-0.9.5-fix-infinite-recursion-on-real_clock_gettime.patch deleted file mode 100644 index 9d81e5e..0000000 --- a/libfaketime-0.9.5-fix-infinite-recursion-on-real_clock_gettime.patch +++ /dev/null @@ -1,13 +0,0 @@ -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"); diff --git a/libfaketime-0.9.6-boottime.patch b/libfaketime-0.9.6-boottime.patch deleted file mode 100644 index 75956d6..0000000 --- a/libfaketime-0.9.6-boottime.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 628c70a67a94b3020cab79171545721dfd295fcd Mon Sep 17 00:00:00 2001 -From: Mario Pareja -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); diff --git a/libfaketime-0.9.8-FORCE_PTHREAD_NONVER.patch b/libfaketime-0.9.8-FORCE_PTHREAD_NONVER.patch new file mode 100644 index 0000000..7e52ec4 --- /dev/null +++ b/libfaketime-0.9.8-FORCE_PTHREAD_NONVER.patch @@ -0,0 +1,26 @@ +From 108370f850e5efd18f4989370cdc6ea6a2f74206 Mon Sep 17 00:00:00 2001 +From: Wolfgang Hommel +Date: Thu, 29 Aug 2019 09:55:04 +0200 +Subject: [PATCH] Adds FORCE_PTHREAD_NONVER flag for platforms where pthread + functions are not intercepted + +--- + src/libfaketime.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libfaketime.c b/src/libfaketime.c +index 5e7ebdf..b70a3d3 100644 +--- a/src/libfaketime.c ++++ b/src/libfaketime.c +@@ -3157,7 +3157,7 @@ int pthread_cond_timedwait_232(pthread_cond_t *cond, pthread_mutex_t *mutex, con + } + + __asm__(".symver pthread_cond_timedwait_225, pthread_cond_timedwait@GLIBC_2.2.5"); +-#ifdef __ARM_ARCH ++#if defined __ARM_ARCH || defined FORCE_PTHREAD_NONVER + __asm__(".symver pthread_cond_timedwait_232, pthread_cond_timedwait@@"); + __asm__(".symver pthread_cond_init_232, pthread_cond_init@@"); + __asm__(".symver pthread_cond_destroy_232, pthread_cond_destroy@@"); +-- +2.21.0 + diff --git a/libfaketime.spec b/libfaketime.spec index 620e94a..4d5e7f1 100644 --- a/libfaketime.spec +++ b/libfaketime.spec @@ -1,14 +1,15 @@ Summary: Manipulate system time per process for testing purposes Name: libfaketime -Version: 0.9.6 -Release: 9%{?dist} +Version: 0.9.8 +Release: 3%{?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 +Url: https://github.com/wolfcw/libfaketime +Source: libfaketime-0.9.8.tar.xz +Patch0: libfaketime-0.9.8-FORCE_PTHREAD_NONVER.patch BuildRequires: gcc +BuildRequires: perl-interpreter +BuildRequires: perl-Time-HiRes %description libfaketime intercepts various system calls which programs use to retrieve the current date and time. It can then report faked dates and @@ -18,15 +19,29 @@ 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 +%patch0 -p1 %build -cd src ; CFLAGS="%{optflags} -Wno-nonnull-compare -Wno-strict-aliasing" make %{?_smp_mflags} \ +cd src +%if 0%{?el7} + %ifarch x86_64 + echo "old glibc https://github.com/wolfcw/libfaketime/issues/202" + export FAKETIME_COMPILE_CFLAGS="-DFORCE_MONOTONIC_FIX" + %endif + %ifarch aarch64 ppc64le + echo "old glibc and pthread_nonver https://github.com/wolfcw/libfaketime/issues/205" + export FAKETIME_COMPILE_CFLAGS="-DFORCE_MONOTONIC_FIX -DFORCE_PTHREAD_NONVER" + %endif +%else + %ifarch ppc64le + echo "pthread_nonver https://github.com/wolfcw/libfaketime/issues/204" + export FAKETIME_COMPILE_CFLAGS="-DFORCE_PTHREAD_NONVER" + %else + unset FAKETIME_COMPILE_CFLAGS + %endif +%endif +CFLAGS="%{optflags} -Wno-nonnull-compare -Wno-strict-aliasing" make %{?_smp_mflags} \ PREFIX="%{_prefix}" LIBDIRNAME="/%{_lib}/faketime" all %check @@ -46,6 +61,13 @@ chmod a+rx %{buildroot}/%{_libdir}/faketime/*.so.* %{_mandir}/man1/* %changelog +* Wed Aug 28 2019 Warren Togami - 0.9.8-3 +- 0.9.8 +- x86_64 EL7: DFORCE_MONOTONIC_FIX + aarch64 EL7: DFORCE_MONOTONIC_FIX and FORCE_PTHREAD_NONVER + ppc64le EL7: DFORCE_MONOTONIC_FIX and FORCE_PTHREAD_NONVER + ppc64le F30+ FORCE_PTHREAD_NONVER + * Fri Feb 01 2019 Fedora Release Engineering - 0.9.6-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild diff --git a/sources b/sources index ab8ac87..d5b4642 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -f522f899d65a057ad69cff9896c75f78 libfaketime-0.9.6.tar.gz +SHA512 (libfaketime-0.9.8.tar.xz) = 6b0deab7aea6b68c3a1e77c022d7a907b7337f75cfce510044c239c7f789e73ed5f1ee3b23ea5b6c8b0cb723c41ed95c1dd9738cca49b9c9840b9022fbfb57b1