Source: faketime Version: 0.9.10-2 Hi. There have been a number of consecutive NMUs for this package, some of which fix quite serious bugs. On the next maintainer upload, please be sure to incorporate those changes.
For your assistance, I have prepared a diff between 0.9.10-2 (the last maintainer upload) and my own recent 0.9.10-2.4. Ian.
diff --git a/debian/changelog b/debian/changelog index 884e466..3f155e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,43 @@ +faketime (0.9.10-2.4) unstable; urgency=medium + + * Non-maintainer upload. + * Upload to unstable, now that builds (including 32-bit) are passing. + (riscv64 and mips64el are lagging but I think likely to pass.) + + -- Ian Jackson <ijack...@chiark.greenend.org.uk> Mon, 13 Jan 2025 09:32:03 +0000 + +faketime (0.9.10-2.4~exp0.1) experimental; urgency=medium + + * Non-maintainer upload. + * Apply patches to try to fix 32-bit platforms. + Closes: #1064555, #1032177, #1079346. [Patches from Helge Deller] + + -- Ian Jackson <ijack...@chiark.greenend.org.uk> Sun, 12 Jan 2025 22:57:56 +0000 + +faketime (0.9.10-2.3) unstable; urgency=medium + + * Non-maintainer upload. + + [ zhangdandan <zhangdan...@loongson.cn> ] + * d/rules: fix hangs on the CLOCK_REALTIME test (Closes: #1085996) + + -- Gianfranco Costamagna <locutusofb...@debian.org> Fri, 08 Nov 2024 14:53:20 +0100 + +faketime (0.9.10-2.2) unstable; urgency=medium + + * Non-maintainer upload. + * Fix linking against libpthread (Closes: #1017865) + + -- Samuel Thibault <sthiba...@debian.org> Thu, 18 Jul 2024 21:45:30 +0000 + +faketime (0.9.10-2.1) unstable; urgency=medium + + * Non-maintainer upload + * test/snippets: fix time.c compiler error on 32-bit arches (Closes: + #1010814) + + -- Paul Gevers <elb...@debian.org> Sat, 13 Aug 2022 20:58:42 +0200 + faketime (0.9.10-2) unstable; urgency=medium * drop unnecessary tweak to version number diff --git a/debian/patches/fix_link.patch b/debian/patches/fix_link.patch new file mode 100644 index 0000000..010aa73 --- /dev/null +++ b/debian/patches/fix_link.patch @@ -0,0 +1,21 @@ +Index: faketime-0.9.10/src/Makefile +=================================================================== +--- faketime-0.9.10.orig/src/Makefile ++++ faketime-0.9.10/src/Makefile +@@ -117,13 +117,13 @@ endif + + LIB_LDFLAGS += -shared + +-LDFLAGS += $(FAKETIME_LINK_FLAGS) -lpthread ++LDFLAGS += $(FAKETIME_LINK_FLAGS) + ifneq ($(PLATFORM),SunOS) + LDFLAGS += -Wl,--version-script=libfaketime.map + endif + +-LDADD += -ldl -lm -lrt +-BIN_LDFLAGS += -lrt ++LDADD += -ldl -lm -lrt -lpthread ++BIN_LDFLAGS += -lrt -lpthread + + SRC = libfaketime.c + LIBS_OBJ = libfaketime.o libfaketimeMT.o diff --git a/debian/patches/fix_time_t_in_test_on_32bits.patch b/debian/patches/fix_time_t_in_test_on_32bits.patch new file mode 100644 index 0000000..69641c8 --- /dev/null +++ b/debian/patches/fix_time_t_in_test_on_32bits.patch @@ -0,0 +1,31 @@ +From ccc9992840598e149dd73d008501ff3887c484ec Mon Sep 17 00:00:00 2001 +From: Nick Rosbrook <nick.rosbr...@canonical.com> +Date: Wed, 10 Aug 2022 14:26:24 -0400 +Subject: [PATCH] test/snippets: fix time.c compiler error on 32-bit arches +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Cast t to unsigned long and use the %lu format specifier instead of %zd. +This is more portable to 32-bit arches, avoiding the following compiler +error: + + snippets/time.c:2:31: error: format â%zdâ expects argument of type âsigned size_tâ, but argument 3 has type âtime_tâ {aka âlong intâ} [-Werror=format=] + 2 | printf("[%s] time() yielded %zd\n", where, t); + | ~~^ ~ + | | | + | int time_t {aka long int} + | %ld + cc1: all warnings being treated as errors +--- + test/snippets/time.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/snippets/time.c b/test/snippets/time.c +index 7153588..568d075 100644 +--- a/test/snippets/time.c ++++ b/test/snippets/time.c +@@ -1,2 +1,2 @@ + time_t t = time(NULL); +-printf("[%s] time() yielded %zd\n", where, t); ++printf("[%s] time() yielded %lu\n", where, (unsigned long)t); diff --git a/debian/patches/interpose-clock_gettime64.patch b/debian/patches/interpose-clock_gettime64.patch new file mode 100644 index 0000000..772335d --- /dev/null +++ b/debian/patches/interpose-clock_gettime64.patch @@ -0,0 +1,81 @@ +From: Helge Deller <del...@gmx.de> +Date: Sun, 12 Jan 2025 22:23:16 +0000 +X-Dgit-Generated: 0.9.10-2.4~exp0.1 1bdadf71f25187595660038434d5142653df64a6 +Subject: Interpose clock_gettime64 + +Since debian generally added 64-bit time support on 32-bit +arches, now glibc sometimes calls the clock_gettime64 syscall +(and library wrapper). This function was missing, and is added here. + +Closes: #1064555 + +--- + +diff --git a/src/libfaketime.c b/src/libfaketime.c +index e632395..b9d3d8d 100644 +--- a/src/libfaketime.c ++++ b/src/libfaketime.c +@@ -159,6 +159,13 @@ struct utimbuf { + #include <sys/random.h> + #endif + ++/* __timespec64 is needed for clock_gettime64 on 32-bit architectures */ ++struct __timespec64 ++{ ++ uint64_t tv_sec; /* Seconds */ ++ uint64_t tv_nsec; /* Nanoseconds */ ++}; ++ + /* + * Per thread variable, which we turn on inside real_* calls to avoid modifying + * time multiple times of for the whole process to prevent faking time +@@ -193,6 +200,7 @@ static time_t (*real_time) (time_t *); + static int (*real_ftime) (struct timeb *); + static int (*real_gettimeofday) (struct timeval *, void *); + static int (*real_clock_gettime) (clockid_t clk_id, struct timespec *tp); ++static int (*real_clock_gettime64) (clockid_t clk_id, struct __timespec64 *tp); + static int (*real_timespec_get) (struct timespec *ts, int base); + #ifdef FAKE_INTERNAL_CALLS + static int (*real___ftime) (struct timeb *); +@@ -2319,6 +2327,17 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp) + return result; + } + ++/* this is used by 32-bit architectures only */ ++int __clock_gettime64(clockid_t clk_id, struct __timespec64 *tp64) ++{ ++ struct timespec tp; ++ int result; ++ ++ result = clock_gettime(clk_id, &tp); ++ tp64->tv_sec = tp.tv_sec; ++ tp64->tv_nsec = tp.tv_nsec; ++ return result; ++} + + #ifdef MACOS_DYLD_INTERPOSE + int macos_timespec_get(struct timespec *ts, int base) +@@ -2652,6 +2671,11 @@ static void ftpl_init(void) + { + real_clock_gettime = dlsym(RTLD_NEXT, "clock_gettime"); + } ++ real_clock_gettime64 = dlsym(RTLD_NEXT, "clock_gettime64"); ++ if (NULL == real_clock_gettime64) ++ { ++ real_clock_gettime64 = dlsym(RTLD_NEXT, "__clock_gettime64"); ++ } + #ifdef FAKE_TIMERS + #if defined(__sun) + real_timer_gettime_233 = dlsym(RTLD_NEXT, "timer_gettime"); +diff --git a/test/Makefile b/test/Makefile +index 983d518..6537a58 100644 +--- a/test/Makefile ++++ b/test/Makefile +@@ -1,6 +1,6 @@ + CC = gcc + +-CFLAGS += -std=gnu99 -Wall -DFAKE_STAT -Werror -Wextra $(FAKETIME_COMPILE_CFLAGS) ++CFLAGS += -std=gnu99 -Wall -DFAKE_STAT -Werror -Wextra $(FAKETIME_COMPILE_CFLAGS) -U_FILE_OFFSET_BITS -U_TIME_BITS + LDFLAGS += -lrt -lpthread + + SRC = timetest.c diff --git a/debian/patches/series b/debian/patches/series index 6dcea82..b226b01 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,4 @@ 0001-tests-avoid-testing-syscall-snippets-if-DINTERCEPT_S.patch +fix_time_t_in_test_on_32bits.patch +fix_link.patch +interpose-clock_gettime64.patch diff --git a/debian/rules b/debian/rules index 03b50a8..7b6f8f2 100755 --- a/debian/rules +++ b/debian/rules @@ -5,7 +5,7 @@ DEB_CFLAGS_MAINT_APPEND=-DMULTI_ARCH # why -DFORCE_PTHREAD_NONVER: see README and # timetest.c and https://github.com/wolfcw/libfaketime/issues/278 # (FORCE_MONOTONIC_FIX should now be autodetected) -ifneq (,$(filter $(DEB_HOST_ARCH),ppc64el riscv64 x32)) +ifneq (,$(filter $(DEB_HOST_ARCH),ppc64el riscv64 x32 loong64)) DEB_CFLAGS_MAINT_APPEND += -DFORCE_PTHREAD_NONVER endif @@ -13,7 +13,7 @@ DEB_CFLAGS_MAINT_APPEND += -DFAKE_RANDOM -DFAKE_PID export DEB_CFLAGS_MAINT_APPEND -export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export DEB_BUILD_MAINT_OPTIONS = hardening=+all abi=-time64 # make sure dh_makeshlibs does not modify post{inst,rm} scripts: # (avoids lintian's postinst-has-useless-call-to-ldconfig) diff --git a/src/Makefile b/src/Makefile index 62e924c..7a1692c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -117,13 +117,13 @@ endif LIB_LDFLAGS += -shared -LDFLAGS += $(FAKETIME_LINK_FLAGS) -lpthread +LDFLAGS += $(FAKETIME_LINK_FLAGS) ifneq ($(PLATFORM),SunOS) LDFLAGS += -Wl,--version-script=libfaketime.map endif -LDADD += -ldl -lm -lrt -BIN_LDFLAGS += -lrt +LDADD += -ldl -lm -lrt -lpthread +BIN_LDFLAGS += -lrt -lpthread SRC = libfaketime.c LIBS_OBJ = libfaketime.o libfaketimeMT.o diff --git a/src/libfaketime.c b/src/libfaketime.c index e632395..b9d3d8d 100644 --- a/src/libfaketime.c +++ b/src/libfaketime.c @@ -159,6 +159,13 @@ struct utimbuf { #include <sys/random.h> #endif +/* __timespec64 is needed for clock_gettime64 on 32-bit architectures */ +struct __timespec64 +{ + uint64_t tv_sec; /* Seconds */ + uint64_t tv_nsec; /* Nanoseconds */ +}; + /* * Per thread variable, which we turn on inside real_* calls to avoid modifying * time multiple times of for the whole process to prevent faking time @@ -193,6 +200,7 @@ static time_t (*real_time) (time_t *); static int (*real_ftime) (struct timeb *); static int (*real_gettimeofday) (struct timeval *, void *); static int (*real_clock_gettime) (clockid_t clk_id, struct timespec *tp); +static int (*real_clock_gettime64) (clockid_t clk_id, struct __timespec64 *tp); static int (*real_timespec_get) (struct timespec *ts, int base); #ifdef FAKE_INTERNAL_CALLS static int (*real___ftime) (struct timeb *); @@ -2319,6 +2327,17 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp) return result; } +/* this is used by 32-bit architectures only */ +int __clock_gettime64(clockid_t clk_id, struct __timespec64 *tp64) +{ + struct timespec tp; + int result; + + result = clock_gettime(clk_id, &tp); + tp64->tv_sec = tp.tv_sec; + tp64->tv_nsec = tp.tv_nsec; + return result; +} #ifdef MACOS_DYLD_INTERPOSE int macos_timespec_get(struct timespec *ts, int base) @@ -2652,6 +2671,11 @@ static void ftpl_init(void) { real_clock_gettime = dlsym(RTLD_NEXT, "clock_gettime"); } + real_clock_gettime64 = dlsym(RTLD_NEXT, "clock_gettime64"); + if (NULL == real_clock_gettime64) + { + real_clock_gettime64 = dlsym(RTLD_NEXT, "__clock_gettime64"); + } #ifdef FAKE_TIMERS #if defined(__sun) real_timer_gettime_233 = dlsym(RTLD_NEXT, "timer_gettime"); diff --git a/test/Makefile b/test/Makefile index 1b2a4aa..6537a58 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,6 +1,6 @@ CC = gcc -CFLAGS += -std=gnu99 -Wall -DFAKE_STAT -Werror -Wextra $(FAKETIME_COMPILE_CFLAGS) +CFLAGS += -std=gnu99 -Wall -DFAKE_STAT -Werror -Wextra $(FAKETIME_COMPILE_CFLAGS) -U_FILE_OFFSET_BITS -U_TIME_BITS LDFLAGS += -lrt -lpthread SRC = timetest.c @@ -13,6 +13,9 @@ ALL_TESTS = timetest test ifneq ($(filter -DINTERCEPT_SYSCALL,${CFLAGS}),) ALL_TESTS += confirm_variadic_promotion +else +TEST_SNIPPETS := $(filter-out syscall%,${TEST_SNIPPETS}) +EXPECTATIONS := $(filter-out syscall%,${EXPECTATIONS}) endif all: $(ALL_TESTS) diff --git a/test/snippets/time.c b/test/snippets/time.c index 7153588..568d075 100644 --- a/test/snippets/time.c +++ b/test/snippets/time.c @@ -1,2 +1,2 @@ time_t t = time(NULL); -printf("[%s] time() yielded %zd\n", where, t); +printf("[%s] time() yielded %lu\n", where, (unsigned long)t);
-- Ian Jackson <ijack...@chiark.greenend.org.uk> These opinions are my own. Pronouns: they/he. If I emailed you from @fyvzl.net or @evade.org.uk, that is a private address which bypasses my fierce spamfilter.