1 |
commit: 8c48112665e85affda864ff1ffa119ab78e3e40d |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 28 02:49:01 2016 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 28 04:46:04 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c481126 |
7 |
|
8 |
dev-vcs/cvs: fix buggy mktime tests #570208 |
9 |
|
10 |
dev-vcs/cvs/cvs-1.12.12-r10.ebuild | 1 + |
11 |
dev-vcs/cvs/cvs-1.12.12-r6.ebuild | 1 + |
12 |
dev-vcs/cvs/cvs-1.12.12-r7.ebuild | 1 + |
13 |
dev-vcs/cvs/cvs-1.12.12-r8.ebuild | 1 + |
14 |
dev-vcs/cvs/cvs-1.12.12-r9.ebuild | 1 + |
15 |
.../cvs/files/cvs-1.12.12-mktime-configure.patch | 201 +++++++++++++++++++++ |
16 |
6 files changed, 206 insertions(+) |
17 |
|
18 |
diff --git a/dev-vcs/cvs/cvs-1.12.12-r10.ebuild b/dev-vcs/cvs/cvs-1.12.12-r10.ebuild |
19 |
index 5198af4..01964f0 100644 |
20 |
--- a/dev-vcs/cvs/cvs-1.12.12-r10.ebuild |
21 |
+++ b/dev-vcs/cvs/cvs-1.12.12-r10.ebuild |
22 |
@@ -41,6 +41,7 @@ src_prepare() { |
23 |
epatch "${FILESDIR}"/${PN}-1.12.12-rcs2log-coreutils.patch # 144114 |
24 |
epatch "${FILESDIR}"/${P}-mktime-x32.patch # 395641 |
25 |
epatch "${FILESDIR}"/${P}-fix-massive-leak.patch |
26 |
+ epatch "${FILESDIR}"/${P}-mktime-configure.patch #220040 #570208 |
27 |
use server || elog "If you want any CVS server functionality, you MUST emerge with USE=server!" |
28 |
} |
29 |
|
30 |
|
31 |
diff --git a/dev-vcs/cvs/cvs-1.12.12-r6.ebuild b/dev-vcs/cvs/cvs-1.12.12-r6.ebuild |
32 |
index 4f5a353..bfc1818 100644 |
33 |
--- a/dev-vcs/cvs/cvs-1.12.12-r6.ebuild |
34 |
+++ b/dev-vcs/cvs/cvs-1.12.12-r6.ebuild |
35 |
@@ -33,6 +33,7 @@ src_unpack() { |
36 |
epatch "${FILESDIR}"/${P}-cvs-gnulib-vasnprintf.patch |
37 |
epatch "${FILESDIR}"/${P}-install-sh.patch |
38 |
epatch "${FILESDIR}"/${P}-mktime-x32.patch # 395641 |
39 |
+ epatch "${FILESDIR}"/${P}-mktime-configure.patch #220040 #570208 |
40 |
use server || elog "If you want any CVS server functionality, you MUST emerge with USE=server!" |
41 |
} |
42 |
|
43 |
|
44 |
diff --git a/dev-vcs/cvs/cvs-1.12.12-r7.ebuild b/dev-vcs/cvs/cvs-1.12.12-r7.ebuild |
45 |
index 754e0c1..b33ca47 100644 |
46 |
--- a/dev-vcs/cvs/cvs-1.12.12-r7.ebuild |
47 |
+++ b/dev-vcs/cvs/cvs-1.12.12-r7.ebuild |
48 |
@@ -37,6 +37,7 @@ src_prepare() { |
49 |
epatch "${FILESDIR}"/${P}-cvs-gnulib-vasnprintf.patch |
50 |
epatch "${FILESDIR}"/${P}-install-sh.patch |
51 |
epatch "${FILESDIR}"/${P}-hash-nameclash.patch # for AIX |
52 |
+ epatch "${FILESDIR}"/${P}-mktime-configure.patch #220040 #570208 |
53 |
elog "If you want any CVS server functionality, you MUST emerge with USE=server!" |
54 |
} |
55 |
|
56 |
|
57 |
diff --git a/dev-vcs/cvs/cvs-1.12.12-r8.ebuild b/dev-vcs/cvs/cvs-1.12.12-r8.ebuild |
58 |
index 18e0e6c..a65db04 100644 |
59 |
--- a/dev-vcs/cvs/cvs-1.12.12-r8.ebuild |
60 |
+++ b/dev-vcs/cvs/cvs-1.12.12-r8.ebuild |
61 |
@@ -38,6 +38,7 @@ src_prepare() { |
62 |
epatch "${FILESDIR}"/${P}-install-sh.patch |
63 |
epatch "${FILESDIR}"/${P}-hash-nameclash.patch # for AIX |
64 |
epatch "${FILESDIR}"/${P}-getdelim.patch # 314791 |
65 |
+ epatch "${FILESDIR}"/${P}-mktime-configure.patch #220040 #570208 |
66 |
elog "If you want any CVS server functionality, you MUST emerge with USE=server!" |
67 |
} |
68 |
|
69 |
|
70 |
diff --git a/dev-vcs/cvs/cvs-1.12.12-r9.ebuild b/dev-vcs/cvs/cvs-1.12.12-r9.ebuild |
71 |
index 4531ce4..d88e63b 100644 |
72 |
--- a/dev-vcs/cvs/cvs-1.12.12-r9.ebuild |
73 |
+++ b/dev-vcs/cvs/cvs-1.12.12-r9.ebuild |
74 |
@@ -40,6 +40,7 @@ src_prepare() { |
75 |
epatch "${FILESDIR}"/${P}-getdelim.patch # 314791 |
76 |
epatch "${FILESDIR}"/${PN}-1.12.12-rcs2log-coreutils.patch # 144114 |
77 |
epatch "${FILESDIR}"/${P}-mktime-x32.patch # 395641 |
78 |
+ epatch "${FILESDIR}"/${P}-mktime-configure.patch #220040 #570208 |
79 |
use server || elog "If you want any CVS server functionality, you MUST emerge with USE=server!" |
80 |
} |
81 |
|
82 |
|
83 |
diff --git a/dev-vcs/cvs/files/cvs-1.12.12-mktime-configure.patch b/dev-vcs/cvs/files/cvs-1.12.12-mktime-configure.patch |
84 |
new file mode 100644 |
85 |
index 0000000..1a9c47b |
86 |
--- /dev/null |
87 |
+++ b/dev-vcs/cvs/files/cvs-1.12.12-mktime-configure.patch |
88 |
@@ -0,0 +1,201 @@ |
89 |
+https://bugs.gentoo.org/220040 |
90 |
+https://bugs.gentoo.org/570208 |
91 |
+ |
92 |
+update mktime check to latest autoconf version which is less buggy |
93 |
+ |
94 |
+--- configure |
95 |
++++ configure |
96 |
+@@ -5299,26 +6059,25 @@ |
97 |
+ cat >>conftest.$ac_ext <<_ACEOF |
98 |
+ /* end confdefs.h. */ |
99 |
+ /* Test program from Paul Eggert and Tony Leneis. */ |
100 |
+-#if TIME_WITH_SYS_TIME |
101 |
++#ifdef TIME_WITH_SYS_TIME |
102 |
+ # include <sys/time.h> |
103 |
+ # include <time.h> |
104 |
+ #else |
105 |
+-# if HAVE_SYS_TIME_H |
106 |
++# ifdef HAVE_SYS_TIME_H |
107 |
+ # include <sys/time.h> |
108 |
+ # else |
109 |
+ # include <time.h> |
110 |
+ # endif |
111 |
+ #endif |
112 |
+ |
113 |
+-#if HAVE_STDLIB_H |
114 |
+-# include <stdlib.h> |
115 |
+-#endif |
116 |
++#include <limits.h> |
117 |
++#include <stdlib.h> |
118 |
+ |
119 |
+-#if HAVE_UNISTD_H |
120 |
++#ifdef HAVE_UNISTD_H |
121 |
+ # include <unistd.h> |
122 |
+ #endif |
123 |
+ |
124 |
+-#if !HAVE_ALARM |
125 |
++#ifndef HAVE_ALARM |
126 |
+ # define alarm(X) /* empty */ |
127 |
+ #endif |
128 |
+ |
129 |
+@@ -5335,9 +6094,9 @@ |
130 |
+ }; |
131 |
+ #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) |
132 |
+ |
133 |
+-/* Fail if mktime fails to convert a date in the spring-forward gap. |
134 |
++/* Return 0 if mktime fails to convert a date in the spring-forward gap. |
135 |
+ Based on a problem report from Andreas Jaeger. */ |
136 |
+-static void |
137 |
++static int |
138 |
+ spring_forward_gap () |
139 |
+ { |
140 |
+ /* glibc (up to about 1998-10-07) failed this test. */ |
141 |
+@@ -5356,29 +6115,27 @@ |
142 |
+ tm.tm_min = 0; |
143 |
+ tm.tm_sec = 0; |
144 |
+ tm.tm_isdst = -1; |
145 |
+- if (mktime (&tm) == (time_t)-1) |
146 |
+- exit (1); |
147 |
++ return mktime (&tm) != (time_t) -1; |
148 |
+ } |
149 |
+ |
150 |
+-static void |
151 |
++static int |
152 |
+ mktime_test1 (now) |
153 |
+ time_t now; |
154 |
+ { |
155 |
+ struct tm *lt; |
156 |
+- if ((lt = localtime (&now)) && mktime (lt) != now) |
157 |
+- exit (1); |
158 |
++ return ! (lt = localtime (&now)) || mktime (lt) == now; |
159 |
+ } |
160 |
+ |
161 |
+-static void |
162 |
++static int |
163 |
+ mktime_test (now) |
164 |
+ time_t now; |
165 |
+ { |
166 |
+- mktime_test1 (now); |
167 |
+- mktime_test1 ((time_t) (time_t_max - now)); |
168 |
+- mktime_test1 ((time_t) (time_t_min + now)); |
169 |
++ return (mktime_test1 (now) |
170 |
++ && mktime_test1 ((time_t) (time_t_max - now)) |
171 |
++ && mktime_test1 ((time_t) (time_t_min + now))); |
172 |
+ } |
173 |
+ |
174 |
+-static void |
175 |
++static int |
176 |
+ irix_6_4_bug () |
177 |
+ { |
178 |
+ /* Based on code from Ariel Faigon. */ |
179 |
+@@ -5391,11 +6148,10 @@ |
180 |
+ tm.tm_sec = 0; |
181 |
+ tm.tm_isdst = -1; |
182 |
+ mktime (&tm); |
183 |
+- if (tm.tm_mon != 2 || tm.tm_mday != 31) |
184 |
+- exit (1); |
185 |
++ return tm.tm_mon == 2 && tm.tm_mday == 31; |
186 |
+ } |
187 |
+ |
188 |
+-static void |
189 |
++static int |
190 |
+ bigtime_test (j) |
191 |
+ int j; |
192 |
+ { |
193 |
+@@ -5417,8 +6173,39 @@ |
194 |
+ && lt->tm_wday == tm.tm_wday |
195 |
+ && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) |
196 |
+ == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) |
197 |
+- exit (1); |
198 |
++ return 0; |
199 |
+ } |
200 |
++ return 1; |
201 |
++} |
202 |
++ |
203 |
++static int |
204 |
++year_2050_test () |
205 |
++{ |
206 |
++ /* The correct answer for 2050-02-01 00:00:00 in Pacific time, |
207 |
++ ignoring leap seconds. */ |
208 |
++ unsigned long int answer = 2527315200UL; |
209 |
++ |
210 |
++ struct tm tm; |
211 |
++ time_t t; |
212 |
++ tm.tm_year = 2050 - 1900; |
213 |
++ tm.tm_mon = 2 - 1; |
214 |
++ tm.tm_mday = 1; |
215 |
++ tm.tm_hour = tm.tm_min = tm.tm_sec = 0; |
216 |
++ tm.tm_isdst = -1; |
217 |
++ |
218 |
++ /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" |
219 |
++ instead of "TZ=America/Vancouver" in order to detect the bug even |
220 |
++ on systems that don't support the Olson extension, or don't have the |
221 |
++ full zoneinfo tables installed. */ |
222 |
++ putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); |
223 |
++ |
224 |
++ t = mktime (&tm); |
225 |
++ |
226 |
++ /* Check that the result is either a failure, or close enough |
227 |
++ to the correct answer that we can assume the discrepancy is |
228 |
++ due to leap seconds. */ |
229 |
++ return (t == (time_t) -1 |
230 |
++ || (0 < t && answer - 120 <= t && t <= answer + 120)); |
231 |
+ } |
232 |
+ |
233 |
+ int |
234 |
+@@ -5432,12 +6219,15 @@ |
235 |
+ isn't worth using anyway. */ |
236 |
+ alarm (60); |
237 |
+ |
238 |
+- for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) |
239 |
+- continue; |
240 |
+- time_t_max--; |
241 |
+- if ((time_t) -1 < 0) |
242 |
+- for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2) |
243 |
+- continue; |
244 |
++ for (;;) |
245 |
++ { |
246 |
++ t = (time_t_max << 1) + 1; |
247 |
++ if (t <= time_t_max) |
248 |
++ break; |
249 |
++ time_t_max = t; |
250 |
++ } |
251 |
++ time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max; |
252 |
++ |
253 |
+ delta = time_t_max / 997; /* a suitable prime number */ |
254 |
+ for (i = 0; i < N_STRINGS; i++) |
255 |
+ { |
256 |
+@@ -5445,18 +6235,22 @@ |
257 |
+ putenv (tz_strings[i]); |
258 |
+ |
259 |
+ for (t = 0; t <= time_t_max - delta; t += delta) |
260 |
+- mktime_test (t); |
261 |
+- mktime_test ((time_t) 1); |
262 |
+- mktime_test ((time_t) (60 * 60)); |
263 |
+- mktime_test ((time_t) (60 * 60 * 24)); |
264 |
+- |
265 |
+- for (j = 1; 0 < j; j *= 2) |
266 |
+- bigtime_test (j); |
267 |
+- bigtime_test (j - 1); |
268 |
++ if (! mktime_test (t)) |
269 |
++ return 1; |
270 |
++ if (! (mktime_test ((time_t) 1) |
271 |
++ && mktime_test ((time_t) (60 * 60)) |
272 |
++ && mktime_test ((time_t) (60 * 60 * 24)))) |
273 |
++ return 1; |
274 |
++ |
275 |
++ for (j = 1; ; j <<= 1) |
276 |
++ if (! bigtime_test (j)) |
277 |
++ return 1; |
278 |
++ else if (INT_MAX / 2 < j) |
279 |
++ break; |
280 |
++ if (! bigtime_test (INT_MAX)) |
281 |
++ return 1; |
282 |
+ } |
283 |
+- irix_6_4_bug (); |
284 |
+- spring_forward_gap (); |
285 |
+- exit (0); |
286 |
++ return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); |
287 |
+ } |
288 |
+ _ACEOF |
289 |
+ rm -f conftest$ac_exeext |