diff options
author | Tim Harder <radhermit@gentoo.org> | 2014-03-06 04:16:57 +0000 |
---|---|---|
committer | Tim Harder <radhermit@gentoo.org> | 2014-03-06 04:16:57 +0000 |
commit | bbc0f2e130868b9e93354bc96203ba6375b1d4c9 (patch) | |
tree | 9f6349e3753e538f2f90896f93d53baefab75700 /sys-libs | |
parent | Remove old. (diff) | |
download | gentoo-2-bbc0f2e130868b9e93354bc96203ba6375b1d4c9.tar.gz gentoo-2-bbc0f2e130868b9e93354bc96203ba6375b1d4c9.tar.bz2 gentoo-2-bbc0f2e130868b9e93354bc96203ba6375b1d4c9.zip |
Version bump.
(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 4AB3E85B4F064CA3)
Diffstat (limited to 'sys-libs')
4 files changed, 234 insertions, 2 deletions
diff --git a/sys-libs/libfaketime/ChangeLog b/sys-libs/libfaketime/ChangeLog index ec49cd8d90ea..fa140ebe8a7b 100644 --- a/sys-libs/libfaketime/ChangeLog +++ b/sys-libs/libfaketime/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-libs/libfaketime -# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/libfaketime/ChangeLog,v 1.6 2013/01/22 17:32:41 ago Exp $ +# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-libs/libfaketime/ChangeLog,v 1.7 2014/03/06 04:16:57 radhermit Exp $ + +*libfaketime-0.9.5 (06 Mar 2014) + + 06 Mar 2014; Tim Harder <radhermit@gentoo.org> +libfaketime-0.9.5.ebuild, + +files/0001-Fake-__clock_gettime-and-similar-calls-using-__.-cal.patch, + +files/0002-Finish-safe-faking-of-internal-calls.patch: + Version bump. 22 Jan 2013; Agostino Sarubbo <ago@gentoo.org> libfaketime-0.9.1.ebuild: Stable for x86, wrt bug #452834 diff --git a/sys-libs/libfaketime/files/0001-Fake-__clock_gettime-and-similar-calls-using-__.-cal.patch b/sys-libs/libfaketime/files/0001-Fake-__clock_gettime-and-similar-calls-using-__.-cal.patch new file mode 100644 index 000000000000..608582b5a745 --- /dev/null +++ b/sys-libs/libfaketime/files/0001-Fake-__clock_gettime-and-similar-calls-using-__.-cal.patch @@ -0,0 +1,154 @@ +From c1cc101f910867191cafa91f52dddf4b8d9bbe9d Mon Sep 17 00:00:00 2001 +From: Balint Reczey <balint@balintreczey.hu> +Date: Wed, 16 Oct 2013 09:16:05 +0200 +Subject: [PATCH 1/2] Fake __clock_gettime() and similar calls using __... + calls + +This breaks potential infinite loops. +--- + src/libfaketime.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 105 insertions(+), 6 deletions(-) + +diff --git a/src/libfaketime.c b/src/libfaketime.c +index 3ec372b..babda94 100644 +--- a/src/libfaketime.c ++++ b/src/libfaketime.c +@@ -115,6 +115,9 @@ 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); + #ifndef __APPLE__ ++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); + #ifdef FAKE_TIMERS + static int (*real_timer_settime_22) (int timerid, int flags, const struct itimerspec *new_value, + struct itimerspec * old_value); +@@ -1865,23 +1868,119 @@ int clock_get_time(clock_serv_t clock_serv, mach_timespec_t *cur_timeclockid_t) + #ifdef FAKE_INTERNAL_CALLS + int __gettimeofday(struct timeval *tv, void *tz) + { +- return gettimeofday(tv, tz); ++ int result; ++ ++ /* sanity check */ ++ if (tv == NULL) ++ { ++ return -1; ++ } ++ ++ /* Check whether we've got a pointer to the real ftime() function yet */ ++ if (NULL == real___gettimeofday) ++ { /* dlsym() failed */ ++#ifdef DEBUG ++ (void) fprintf(stderr, "faketime problem: original __gettimeofday() not found.\n"); ++#endif ++ return -1; /* propagate error to caller */ ++ } ++ ++ /* initialize our result with the real current time */ ++ DONT_FAKE_TIME(result = (*real___gettimeofday)(tv, tz)); ++ if (result == -1) return result; /* original function failed */ ++ ++ /* pass the real current time to our faking version, overwriting it */ ++ result = fake_gettimeofday(tv); ++ ++ /* return the result to the caller */ ++ return result; + } + + int __clock_gettime(clockid_t clk_id, struct timespec *tp) + { +- return clock_gettime(clk_id, tp); ++ int result; ++ ++ /* sanity check */ ++ if (tp == NULL) ++ { ++ return -1; ++ } ++ ++ if (NULL == real___clock_gettime) ++ { /* dlsym() failed */ ++#ifdef DEBUG ++ (void) fprintf(stderr, "faketime problem: original __clock_gettime() not found.\n"); ++#endif ++ return -1; /* propagate error to caller */ ++ } ++ ++ /* initialize our result with the real current time */ ++ DONT_FAKE_TIME(result = (*real___clock_gettime)(clk_id, tp)); ++ if (result == -1) return result; /* original function failed */ ++ ++ /* pass the real current time to our faking version, overwriting it */ ++ result = fake_clock_gettime(clk_id, tp); ++ ++ /* return the result to the caller */ ++ return result; + } + +-int __ftime(struct timeb *tp) ++time_t __time(time_t *time_tptr) + { +- return ftime(tp); ++ struct timespec tp; ++ time_t result; ++ ++ DONT_FAKE_TIME(result = (*real___clock_gettime)(CLOCK_REALTIME, &tp)); ++ if (result == -1) return -1; ++ ++ /* pass the real current time to our faking version, overwriting it */ ++ (void)fake_clock_gettime(CLOCK_REALTIME, &tp); ++ ++ if (time_tptr != NULL) ++ { ++ *time_tptr = tp.tv_sec; ++ } ++ return tp.tv_sec; + } + +-time_t __time(time_t *time_tptr) ++int __ftime(struct timeb *tb) + { +- return time(time_tptr); ++ struct timespec tp; ++ int result; ++ ++ /* sanity check */ ++ if (tb == NULL) ++ return 0; /* ftime() always returns 0, see manpage */ ++ ++ /* Check whether we've got a pointer to the real ftime() function yet */ ++ if (NULL == real___ftime) ++ { /* dlsym() failed */ ++#ifdef DEBUG ++ (void) fprintf(stderr, "faketime problem: original ftime() not found.\n"); ++#endif ++ return 0; /* propagate error to caller */ ++ } ++ ++ /* initialize our TZ result with the real current time */ ++ DONT_FAKE_TIME(result = (*real___ftime)(tb)); ++ if (result == -1) ++ { ++ return result; ++ } ++ ++ DONT_FAKE_TIME(result = (*real_clock_gettime)(CLOCK_REALTIME, &tp)); ++ if (result == -1) return -1; ++ ++ /* pass the real current time to our faking version, overwriting it */ ++ (void)fake_clock_gettime(CLOCK_REALTIME, &tp); ++ ++ tb->time = tp.tv_sec; ++ tb->millitm = tp.tv_nsec / 1000000; ++ ++ /* return the result to the caller */ ++ return result; /* will always be 0 (see manpage) */ + } ++ + #endif + #endif + +-- +1.9.0 + diff --git a/sys-libs/libfaketime/files/0002-Finish-safe-faking-of-internal-calls.patch b/sys-libs/libfaketime/files/0002-Finish-safe-faking-of-internal-calls.patch new file mode 100644 index 000000000000..57ed04c20574 --- /dev/null +++ b/sys-libs/libfaketime/files/0002-Finish-safe-faking-of-internal-calls.patch @@ -0,0 +1,40 @@ +From c719a977a724c4d83a8f850784b95377f61abe78 Mon Sep 17 00:00:00 2001 +From: Balint Reczey <balint@balintreczey.hu> +Date: Wed, 16 Oct 2013 09:33:50 +0200 +Subject: [PATCH 2/2] Finish safe faking of internal calls + +--- + src/libfaketime.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/libfaketime.c b/src/libfaketime.c +index babda94..1f8a6c4 100644 +--- a/src/libfaketime.c ++++ b/src/libfaketime.c +@@ -115,9 +115,11 @@ 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); + #ifndef __APPLE__ ++#ifdef FAKE_INTERNAL_CALLS + 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); ++#endif + #ifdef FAKE_TIMERS + static int (*real_timer_settime_22) (int timerid, int flags, const struct itimerspec *new_value, + struct itimerspec * old_value); +@@ -1390,6 +1392,11 @@ void __attribute__ ((constructor)) ftpl_init(void) + real_timer_gettime_22 = dlvsym(RTLD_NEXT, "timer_gettime","GLIBC_2.2"); + real_timer_gettime_233 = dlvsym(RTLD_NEXT, "timer_gettime","GLIBC_2.3.3"); + #endif ++#ifdef FAKE_INTERNAL_CALLS ++ real___ftime = dlsym(RTLD_NEXT, "__ftime"); ++ real___gettimeofday = dlsym(RTLD_NEXT, "__gettimeofday"); ++ real___clock_gettime = dlsym(RTLD_NEXT, "__clock_gettime"); ++#endif + #endif + + ft_shm_init(); +-- +1.9.0 + diff --git a/sys-libs/libfaketime/libfaketime-0.9.5.ebuild b/sys-libs/libfaketime/libfaketime-0.9.5.ebuild new file mode 100644 index 000000000000..1cac95856211 --- /dev/null +++ b/sys-libs/libfaketime/libfaketime-0.9.5.ebuild @@ -0,0 +1,31 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-libs/libfaketime/libfaketime-0.9.5.ebuild,v 1.1 2014/03/06 04:16:56 radhermit Exp $ + +EAPI=5 + +inherit eutils toolchain-funcs multilib + +DESCRIPTION="Report faked system time to programs" +HOMEPAGE="http://www.code-wizards.com/projects/libfaketime/ https://github.com/wolfcw/libfaketime/" +SRC_URI="http://www.code-wizards.com/projects/${PN}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +src_prepare() { + epatch "${FILESDIR}"/0001-Fake-__clock_gettime-and-similar-calls-using-__.-cal.patch + epatch "${FILESDIR}"/0002-Finish-safe-faking-of-internal-calls.patch + tc-export CC +} + +src_install() { + dobin src/faketime + doman man/faketime.1 + exeinto /usr/$(get_libdir)/faketime + doexe src/${PN}*.so.* + dosym ${PN}.so.1 /usr/$(get_libdir)/faketime/${PN}.so + dosym ${PN}MT.so.1 /usr/$(get_libdir)/faketime/${PN}MT.so + dodoc NEWS README TODO +} |