perl.patch 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. "A security hole has been discovered in Safe.pm. When a Safe compartment
  2. has already been used, there's no guarantee that it's safe any longer,
  3. because there's a way for code executed within the Safe compartment to
  4. alter its operation mask. (Thus, programs that use a Safe compartment
  5. only once aren't affected by this bug.)"
  6. --- ext/Opcode/Safe.pm.orig
  7. +++ ext/Opcode/Safe.pm
  8. @@ -213,7 +213,7 @@
  9. # Create anon sub ref in root of compartment.
  10. # Uses a closure (on $expr) to pass in the code to be executed.
  11. # (eval on one line to keep line numbers as expected by caller)
  12. - my $evalcode = sprintf('package %s; sub { eval $expr; }', $root);
  13. + my $evalcode = sprintf('package %s; sub { @_ = (); eval $expr; }', $root);
  14. my $evalsub;
  15. if ($strict) { use strict; $evalsub = eval $evalcode; }
  16. @@ -227,7 +227,7 @@
  17. my $root = $obj->{Root};
  18. my $evalsub = eval
  19. - sprintf('package %s; sub { do $file }', $root);
  20. + sprintf('package %s; sub { @_ = (); do $file }', $root);
  21. return Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
  22. }
  23. -----------------------------------------------------------------------------
  24. By default, the Perl module search order is "use lib, -I, PERL[5]LIB,
  25. perl, site, vendor, other". This means that in OpenPKG both the modules
  26. installed via CPAN shell (in "site" area) and the "perl-xxx" packages
  27. (in "vendor" area) cannot override the (sometimes obsoleted) module
  28. versions distributed with Perl (in "perl" area). Hence, we change
  29. the search order to a more reasonable one for OpenPKG: "use lib, -I,
  30. PERL[5]LIB, site, vendor, perl, other".
  31. --- perl.c.orig 2002-07-09 21:41:43.000000000 +0200
  32. +++ perl.c 2003-09-03 14:08:25.000000000 +0200
  33. @@ -3679,39 +3679,6 @@
  34. incpush(APPLLIB_EXP, TRUE, TRUE);
  35. #endif
  36. -#ifdef ARCHLIB_EXP
  37. - incpush(ARCHLIB_EXP, FALSE, FALSE);
  38. -#endif
  39. -#ifdef MACOS_TRADITIONAL
  40. - {
  41. - Stat_t tmpstatbuf;
  42. - SV * privdir = NEWSV(55, 0);
  43. - char * macperl = PerlEnv_getenv("MACPERL");
  44. -
  45. - if (!macperl)
  46. - macperl = "";
  47. -
  48. - Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
  49. - if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  50. - incpush(SvPVX(privdir), TRUE, FALSE);
  51. - Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
  52. - if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  53. - incpush(SvPVX(privdir), TRUE, FALSE);
  54. -
  55. - SvREFCNT_dec(privdir);
  56. - }
  57. - if (!PL_tainting)
  58. - incpush(":", FALSE, FALSE);
  59. -#else
  60. -#ifndef PRIVLIB_EXP
  61. -# define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
  62. -#endif
  63. -#if defined(WIN32)
  64. - incpush(PRIVLIB_EXP, TRUE, FALSE);
  65. -#else
  66. - incpush(PRIVLIB_EXP, FALSE, FALSE);
  67. -#endif
  68. -
  69. #ifdef SITEARCH_EXP
  70. /* sitearch is always relative to sitelib on Windows for
  71. * DLL-based path intuition to work correctly */
  72. @@ -3752,6 +3719,39 @@
  73. incpush(PERL_VENDORLIB_STEM, FALSE, TRUE);
  74. #endif
  75. +#ifdef ARCHLIB_EXP
  76. + incpush(ARCHLIB_EXP, FALSE, FALSE);
  77. +#endif
  78. +#ifdef MACOS_TRADITIONAL
  79. + {
  80. + Stat_t tmpstatbuf;
  81. + SV * privdir = NEWSV(55, 0);
  82. + char * macperl = PerlEnv_getenv("MACPERL");
  83. +
  84. + if (!macperl)
  85. + macperl = "";
  86. +
  87. + Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
  88. + if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  89. + incpush(SvPVX(privdir), TRUE, FALSE);
  90. + Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
  91. + if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
  92. + incpush(SvPVX(privdir), TRUE, FALSE);
  93. +
  94. + SvREFCNT_dec(privdir);
  95. + }
  96. + if (!PL_tainting)
  97. + incpush(":", FALSE, FALSE);
  98. +#else
  99. +#ifndef PRIVLIB_EXP
  100. +# define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
  101. +#endif
  102. +#if defined(WIN32)
  103. + incpush(PRIVLIB_EXP, TRUE, FALSE);
  104. +#else
  105. + incpush(PRIVLIB_EXP, FALSE, FALSE);
  106. +#endif
  107. +
  108. #ifdef PERL_OTHERLIBDIRS
  109. incpush(PERL_OTHERLIBDIRS, TRUE, TRUE);
  110. #endif
  111. -----------------------------------------------------------------------------
  112. By default, the "vendor" area is not used, so Perl's installation
  113. procedure forgot to create its top-level paths, too. In OpenPKG we use
  114. the "vendor" area, so make sure it is created the same way the "site"
  115. area is.
  116. --- installperl.orig 2002-07-16 20:57:32.000000000 +0200
  117. +++ installperl 2003-09-03 14:27:11.000000000 +0200
  118. @@ -174,6 +174,8 @@
  119. my $installarchlib = $Config{installarchlib};
  120. my $installsitelib = $Config{installsitelib};
  121. my $installsitearch = $Config{installsitearch};
  122. +my $installvendorlib = $Config{installvendorlib};
  123. +my $installvendorarch = $Config{installvendorarch};
  124. my $installman1dir = $Config{installman1dir};
  125. my $man1ext = $Config{man1ext};
  126. my $libperl = $Config{libperl};
  127. @@ -336,6 +338,8 @@
  128. mkpath($installarchlib, $verbose, 0777);
  129. mkpath($installsitelib, $verbose, 0777) if ($installsitelib);
  130. mkpath($installsitearch, $verbose, 0777) if ($installsitearch);
  131. +mkpath($installvendorlib, $verbose, 0777) if ($installvendorlib);
  132. +mkpath($installvendorarch, $verbose, 0777) if ($installvendorarch);
  133. if (chdir "lib") {
  134. $do_installarchlib = ! samepath($installarchlib, '.');