perl58.patch 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. By default, the "vendor" area is not used, so Perl's installation
  2. procedure forgot to create its top-level paths, too. In OpenPKG we use
  3. the "vendor" area, so make sure it is created the same way the "site"
  4. area is.
  5. Index: installperl
  6. --- installperl.orig 2006-01-28 16:35:28 +0100
  7. +++ installperl 2006-02-01 20:00:56 +0100
  8. @@ -189,6 +189,8 @@
  9. my $installarchlib = "$destdir$Config{installarchlib}";
  10. my $installsitelib = "$destdir$Config{installsitelib}";
  11. my $installsitearch = "$destdir$Config{installsitearch}";
  12. +my $installvendorlib = "$destdir$Config{installvendorlib}";
  13. +my $installvendorarch = "$destdir$Config{installvendorarch}";
  14. my $installman1dir = "$destdir$Config{installman1dir}";
  15. my $man1ext = $Config{man1ext};
  16. my $libperl = $Config{libperl};
  17. @@ -381,6 +383,8 @@
  18. mkpath($installarchlib, $verbose, 0777);
  19. mkpath($installsitelib, $verbose, 0777) if ($installsitelib);
  20. mkpath($installsitearch, $verbose, 0777) if ($installsitearch);
  21. +mkpath($installvendorlib, $verbose, 0777) if ($installvendorlib);
  22. +mkpath($installvendorarch, $verbose, 0777) if ($installvendorarch);
  23. if (chdir "lib") {
  24. $do_installarchlib = ! samepath($installarchlib, '.');
  25. -----------------------------------------------------------------------------
  26. By default, the Perl module search order is "use lib, -I, PERL[5]LIB,
  27. perl, site, vendor, other". This means that in OpenPKG both the modules
  28. installed via CPAN shell (in "site" area) and the "perl-xxx" packages
  29. (in "vendor" area) cannot override the (sometimes obsoleted) module
  30. versions distributed with Perl (in "perl" area). Hence, we change
  31. the search order to a more reasonable one for OpenPKG: "use lib, -I,
  32. PERL[5]LIB, site, vendor, perl, other".
  33. Index: perl.c
  34. --- perl.c.orig 2006-01-31 13:34:47 +0100
  35. +++ perl.c 2006-02-01 20:00:56 +0100
  36. @@ -4776,39 +4776,6 @@
  37. incpush(APPLLIB_EXP, TRUE, TRUE, TRUE);
  38. #endif
  39. -#ifdef ARCHLIB_EXP
  40. - incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE);
  41. -#endif
  42. -#ifdef MACOS_TRADITIONAL
  43. - {
  44. - Stat_t tmpstatbuf;
  45. - SV * privdir = NEWSV(55, 0);
  46. - char * macperl = PerlEnv_getenv("MACPERL");
  47. -
  48. - if (!macperl)
  49. - macperl = "";
  50. -
  51. - Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
  52. - if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  53. - incpush(SvPVX(privdir), TRUE, FALSE, TRUE);
  54. - Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
  55. - if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  56. - incpush(SvPVX(privdir), TRUE, FALSE, TRUE);
  57. -
  58. - SvREFCNT_dec(privdir);
  59. - }
  60. - if (!PL_tainting)
  61. - incpush(":", FALSE, FALSE, TRUE);
  62. -#else
  63. -#ifndef PRIVLIB_EXP
  64. -# define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
  65. -#endif
  66. -#if defined(WIN32)
  67. - incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE);
  68. -#else
  69. - incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE);
  70. -#endif
  71. -
  72. #ifdef SITEARCH_EXP
  73. /* sitearch is always relative to sitelib on Windows for
  74. * DLL-based path intuition to work correctly */
  75. @@ -4850,6 +4817,39 @@
  76. incpush(PERL_VENDORLIB_STEM, FALSE, TRUE, TRUE);
  77. #endif
  78. +#ifdef ARCHLIB_EXP
  79. + incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE);
  80. +#endif
  81. +#ifdef MACOS_TRADITIONAL
  82. + {
  83. + Stat_t tmpstatbuf;
  84. + SV * privdir = NEWSV(55, 0);
  85. + char * macperl = PerlEnv_getenv("MACPERL");
  86. +
  87. + if (!macperl)
  88. + macperl = "";
  89. +
  90. + Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
  91. + if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  92. + incpush(SvPVX(privdir), TRUE, FALSE, TRUE);
  93. + Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
  94. + if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  95. + incpush(SvPVX(privdir), TRUE, FALSE, TRUE);
  96. +
  97. + SvREFCNT_dec(privdir);
  98. + }
  99. + if (!PL_tainting)
  100. + incpush(":", FALSE, FALSE, TRUE);
  101. +#else
  102. +#ifndef PRIVLIB_EXP
  103. +# define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
  104. +#endif
  105. +#if defined(WIN32)
  106. + incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE);
  107. +#else
  108. + incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE);
  109. +#endif
  110. +
  111. #ifdef PERL_OTHERLIBDIRS
  112. incpush(PERL_OTHERLIBDIRS, TRUE, TRUE, TRUE);
  113. #endif
  114. -----------------------------------------------------------------------------
  115. Port to [Open]Darwin 6.6.2:
  116. 1. In OpenPKG, Perl does not use the vendor GCC and our GCC does not
  117. understand "-no-cpp-precomp", so remove this build option.
  118. 2. The <sys/mman.h> indirectly includes system specific headers
  119. which in turn have fields named "environ" while Perl uses
  120. a define of "environ" internally. So wrap the inclusion.
  121. 3. Darwin 6 no longer accepts the non-standard "#import" statements,
  122. so replace with "#include" and circumvent some header problem
  123. related to the non-standard "__private_extern__" attribute.
  124. Index: hints/darwin.sh
  125. --- hints/darwin.sh.orig 2005-09-18 17:13:41 +0200
  126. +++ hints/darwin.sh 2006-02-01 20:00:56 +0100
  127. @@ -120,9 +120,6 @@
  128. *-2147483648) ccflags="${ccflags} -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN" ;;
  129. esac
  130. -# Avoid Apple's cpp precompiler, better for extensions
  131. -cppflags="${cppflags} -no-cpp-precomp"
  132. -
  133. # This is necessary because perl's build system doesn't
  134. # apply cppflags to cc compile lines as it should.
  135. ccflags="${ccflags} ${cppflags}"
  136. @@ -182,8 +179,7 @@
  137. esac
  138. ldlibpthname='DYLD_LIBRARY_PATH';
  139. -# useshrplib=true results in much slower startup times.
  140. -# 'false' is the default value. Use Configure -Duseshrplib to override.
  141. +useshrplib='true'
  142. cat > UU/archname.cbu <<'EOCBU'
  143. # This script UU/archname.cbu will get 'called-back' by Configure
  144. Index: perlio.c
  145. --- perlio.c.orig 2006-01-06 23:42:20 +0100
  146. +++ perlio.c 2006-02-01 20:00:56 +0100
  147. @@ -448,7 +448,14 @@
  148. #include <unistd.h>
  149. #endif
  150. #ifdef HAS_MMAP
  151. +#ifdef PERL_DARWIN
  152. +#define environ_safe environ
  153. +#undef environ
  154. #include <sys/mman.h>
  155. +#define environ environ_safe
  156. +#else
  157. +#include <sys/mman.h>
  158. +#endif
  159. #endif
  160. void
  161. Index: ext/DynaLoader/dl_dyld.xs
  162. --- ext/DynaLoader/dl_dyld.xs.orig 2005-04-18 19:04:24 +0200
  163. +++ ext/DynaLoader/dl_dyld.xs 2006-02-01 20:00:56 +0100
  164. @@ -45,7 +45,13 @@
  165. #undef environ
  166. #undef bool
  167. +#ifdef PERL_DARWIN
  168. +#define __private_extern__ extern
  169. +#include <mach-o/dyld.h>
  170. +#undef __private_extern__
  171. +#else
  172. #import <mach-o/dyld.h>
  173. +#endif
  174. static char *dlerror()
  175. {
  176. -----------------------------------------------------------------------------
  177. Port to Tru64 5.1:
  178. Under Tru64 our gcc has to be built without binutils and the system
  179. ld(1) does not accept a "-O" option, so remove the whole passing of
  180. optimization flags to ld(1). Under a brain-dead platform like Tru64 we
  181. really don't need any more optimization because we are already happy if
  182. it works at all.
  183. Index: hints/dec_osf.sh
  184. --- hints/dec_osf.sh.orig 2006-01-08 10:53:29 +0100
  185. +++ hints/dec_osf.sh 2006-02-01 20:00:56 +0100
  186. @@ -279,15 +279,6 @@
  187. *) if $test "X$optimize" = "X$undef"; then
  188. lddlflags="$lddlflags -msym"
  189. else
  190. - case "$myosvers" in
  191. - *4.0D*)
  192. - # QAR 56761: -O4 + .so may produce broken code,
  193. - # fixed in 4.0E or better.
  194. - ;;
  195. - *)
  196. - lddlflags="$lddlflags $optimize"
  197. - ;;
  198. - esac
  199. # -msym: If using a sufficiently recent /sbin/loader,
  200. # keep the module symbols with the modules.
  201. lddlflags="$lddlflags -msym $_lddlflags_strict_ansi"
  202. -----------------------------------------------------------------------------
  203. http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0976
  204. Multiple scripts in the perl package in Trustix Secure Linux 1.5
  205. through 2.1, and possibly other operating systems, allows local
  206. users to overwrite files via a symlink attack on temporary files.
  207. Index: lib/CGI/Cookie.pm
  208. --- lib/CGI/Cookie.pm.orig 2005-12-05 17:30:25 +0100
  209. +++ lib/CGI/Cookie.pm 2006-02-01 20:00:56 +0100
  210. @@ -407,7 +407,7 @@
  211. You may also retrieve cookies that were stored in some external
  212. form using the parse() class method:
  213. - $COOKIES = `cat /usr/tmp/Cookie_stash`;
  214. + $COOKIES = `cat /var/run/www/Cookie_stash`;
  215. %cookies = parse CGI::Cookie($COOKIES);
  216. If you are in a mod_perl environment, you can save some overhead by
  217. Index: lib/Shell.pm
  218. --- lib/Shell.pm.orig 2004-06-01 11:42:17 +0200
  219. +++ lib/Shell.pm 2006-02-01 20:00:56 +0100
  220. @@ -127,7 +127,7 @@
  221. use Shell qw(cat ps cp);
  222. $passwd = cat('</etc/passwd');
  223. @pslines = ps('-ww'),
  224. - cp("/etc/passwd", "/tmp/passwd");
  225. + cp("/etc/passwd", "/etc/passwd.orig");
  226. # object oriented
  227. my $sh = Shell->new;
  228. -----------------------------------------------------------------------------
  229. Index: Configure
  230. --- Configure.orig 2006-01-08 15:51:03 +0100
  231. +++ Configure 2006-02-01 20:00:56 +0100
  232. @@ -7663,7 +7663,7 @@
  233. ;;
  234. linux|irix*|gnu*) dflt='-shared' ;;
  235. next) dflt='none' ;;
  236. - solaris) dflt='-G' ;;
  237. + solaris) dflt='-shared' ;;
  238. sunos) dflt='-assert nodefinitions' ;;
  239. svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
  240. *) dflt='none' ;;
  241. -----------------------------------------------------------------------------
  242. Security Fix (CVE-2005-3962, OpenPKG-SA-2005.025-perl)
  243. Index: sv.c
  244. --- sv.c.orig 2006-01-16 13:22:21 +0100
  245. +++ sv.c 2006-02-01 20:00:56 +0100
  246. @@ -8650,7 +8650,10 @@
  247. if (EXPECT_NUMBER(q, width)) {
  248. if (*q == '$') {
  249. ++q;
  250. - efix = width;
  251. + if (width > PERL_INT_MAX)
  252. + efix = PERL_INT_MAX;
  253. + else
  254. + efix = width;
  255. } else {
  256. goto gotwidth;
  257. }
  258. -----------------------------------------------------------------------------
  259. - Fix syntax error (unterminated quoted string)
  260. - Support GCC 4.2
  261. Index: makedepend.SH
  262. --- makedepend.SH.orig 2003-06-05 20:11:10 +0200
  263. +++ makedepend.SH 2007-05-20 09:32:10 +0200
  264. @@ -128,7 +128,7 @@
  265. *.y) filebase=`basename $file .y` ;;
  266. esac
  267. case "$file" in
  268. - */*) finc="-I`echo $file | sed 's#/[^/]*$##`" ;;
  269. + */*) finc="-I`echo $file | sed 's#/[^/]*$##'`" ;;
  270. *) finc= ;;
  271. esac
  272. $echo "Finding dependencies for $filebase$_o."
  273. @@ -167,6 +167,7 @@
  274. -e '/^#.*<builtin>/d' \
  275. -e '/^#.*<built-in>/d' \
  276. -e '/^#.*<command line>/d' \
  277. + -e '/^#.*<command-line>/d' \
  278. -e '/^#.*"-"/d' \
  279. -e '/: file path prefix .* never used$/d' \
  280. -e 's#\.[0-9][0-9]*\.c#'"$file.c#" \
  281. -----------------------------------------------------------------------------
  282. Support FreeBSD >= 7.0 where objformat(8) is gone
  283. Index: hints/freebsd.sh
  284. --- hints/freebsd.sh.orig Wed Mar 24 22:47:33 2004
  285. +++ hints/freebsd.sh Mon Feb 19 20:53:50 2007
  286. @@ -116,17 +122,17 @@ case "$osvers" in
  287. *)
  288. objformat=`/usr/bin/objformat`
  289. - if [ x$objformat = xelf ]; then
  290. - libpth="/usr/lib /usr/local/lib"
  291. - glibpth="/usr/lib /usr/local/lib"
  292. - ldflags="-Wl,-E "
  293. - lddlflags="-shared "
  294. - else
  295. + if [ x$objformat = xaout ]; then
  296. if [ -e /usr/lib/aout ]; then
  297. libpth="/usr/lib/aout /usr/local/lib /usr/lib"
  298. glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
  299. fi
  300. lddlflags='-Bshareable'
  301. + else
  302. + libpth="/usr/lib /usr/local/lib"
  303. + glibpth="/usr/lib /usr/local/lib"
  304. + ldflags="-Wl,-E "
  305. + lddlflags="-shared "
  306. fi
  307. cccdlflags='-DPIC -fPIC'
  308. ;;
  309. -----------------------------------------------------------------------------
  310. Fix issue when <asm/page.h> is missing from the Linux headers.
  311. See https://bugs.gentoo.org/show_bug.cgi?id=168312 for details.
  312. Index: ext/IPC/SysV/SysV.xs
  313. --- ext/IPC/SysV/SysV.xs.orig 2001-06-30 14:46:07.000000000 -0400
  314. +++ ext/IPC/SysV/SysV.xs 2006-06-02 17:37:22.000000000 -0400
  315. @@ -3,9 +3,6 @@
  316. #include "XSUB.h"
  317. #include <sys/types.h>
  318. -#ifdef __linux__
  319. -# include <asm/page.h>
  320. -#endif
  321. #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM)
  322. #ifndef HAS_SEM
  323. # include <sys/ipc.h>
  324. -----------------------------------------------------------------------------
  325. Security Fix (CVE-2007-5116)
  326. Fix a possible buffer overflow with ASCII regexes
  327. that really are Unicode regexes.
  328. Index: regcomp.c
  329. --- regcomp.c.orig 2006-01-08 21:59:27.000000000 +0100
  330. +++ regcomp.c 2007-11-06 22:48:26.000000000 +0100
  331. @@ -135,7 +135,10 @@ typedef struct RExC_state_t {
  332. I32 extralen;
  333. I32 seen_zerolen;
  334. I32 seen_evals;
  335. - I32 utf8;
  336. + I32 utf8; /* whether the pattern is utf8 or not */
  337. + I32 orig_utf8; /* whether the pattern was originally in utf8 */
  338. + /* XXX use this for future optimisation of case
  339. + * where pattern must be upgraded to utf8. */
  340. #if ADD_TO_REGEXEC
  341. char *starttry; /* -Dr: where regtry was called. */
  342. #define RExC_starttry (pRExC_state->starttry)
  343. @@ -161,6 +164,7 @@ typedef struct RExC_state_t {
  344. #define RExC_seen_zerolen (pRExC_state->seen_zerolen)
  345. #define RExC_seen_evals (pRExC_state->seen_evals)
  346. #define RExC_utf8 (pRExC_state->utf8)
  347. +#define RExC_orig_utf8 (pRExC_state->orig_utf8)
  348. #define ISMULT1(c) ((c) == '*' || (c) == '+' || (c) == '?')
  349. #define ISMULT2(s) ((*s) == '*' || (*s) == '+' || (*s) == '?' || \
  350. @@ -1749,15 +1753,16 @@ Perl_pregcomp(pTHX_ char *exp, char *xen
  351. if (exp == NULL)
  352. FAIL("NULL regexp argument");
  353. - RExC_utf8 = pm->op_pmdynflags & PMdf_CMP_UTF8;
  354. + RExC_utf8 = RExC_orig_utf8 = pm->op_pmdynflags & PMdf_CMP_UTF8;
  355. - RExC_precomp = exp;
  356. DEBUG_r({
  357. if (!PL_colorset) reginitcolors();
  358. PerlIO_printf(Perl_debug_log, "%sCompiling REx%s `%s%*s%s'\n",
  359. PL_colors[4],PL_colors[5],PL_colors[0],
  360. - (int)(xend - exp), RExC_precomp, PL_colors[1]);
  361. + (int)(xend - exp), exp, PL_colors[1]);
  362. });
  363. +redo_first_pass:
  364. + RExC_precomp = exp;
  365. RExC_flags = pm->op_pmflags;
  366. RExC_sawback = 0;
  367. @@ -1783,6 +1788,25 @@ Perl_pregcomp(pTHX_ char *exp, char *xen
  368. RExC_precomp = Nullch;
  369. return(NULL);
  370. }
  371. + if (RExC_utf8 && !RExC_orig_utf8) {
  372. + /* It's possible to write a regexp in ascii that represents unicode
  373. + codepoints outside of the byte range, such as via \x{100}. If we
  374. + detect such a sequence we have to convert the entire pattern to utf8
  375. + and then recompile, as our sizing calculation will have been based
  376. + on 1 byte == 1 character, but we will need to use utf8 to encode
  377. + at least some part of the pattern, and therefore must convert the whole
  378. + thing.
  379. + XXX: somehow figure out how to make this less expensive...
  380. + -- dmq */
  381. + STRLEN len = xend-exp;
  382. + DEBUG_r(PerlIO_printf(Perl_debug_log,
  383. + "UTF8 mismatch! Converting to utf8 for resizing and compile\n"));
  384. + exp = (char*)Perl_bytes_to_utf8(aTHX_ (U8*)exp, &len);
  385. + xend = exp + len;
  386. + RExC_orig_utf8 = RExC_utf8;
  387. + SAVEFREEPV(exp);
  388. + goto redo_first_pass;
  389. + }
  390. DEBUG_r(PerlIO_printf(Perl_debug_log, "size %"IVdf" ", (IV)RExC_size));
  391. /* Small enough for pointer-storage convention?
  392. Index: t/op/pat.t
  393. --- t/op/pat.t.orig 2006-01-07 13:53:32.000000000 +0100
  394. +++ t/op/pat.t 2007-11-06 21:52:30.000000000 +0100
  395. @@ -6,7 +6,7 @@
  396. $| = 1;
  397. -print "1..1187\n";
  398. +print "1..1189\n";
  399. BEGIN {
  400. chdir 't' if -d 't';
  401. @@ -3395,5 +3395,14 @@ ok(("foba ba$s" =~ qr/(foo|BaSS|bar)/i)
  402. "# assigning to original string should not corrupt match vars");
  403. }
  404. -# last test 1187
  405. +{
  406. + use warnings;
  407. + my @w;
  408. + local $SIG{__WARN__}=sub{push @w,"@_"};
  409. + my $c=qq(\x{DF});
  410. + ok($c=~/${c}|\x{100}/, "ASCII pattern that really is utf8");
  411. + ok(@w==0, "ASCII pattern that really is utf8");
  412. +}
  413. +
  414. +# last test 1189