Update perl from version 5.10.1nb2 to version 5.12.1.

Pkgsrc changes:
- Adjust some patches
- Remove patches integrated upstream
- Use Perl's "Policy.sh" framework (along the way remove some patches)
- Link in an enterprise friendly way on HPUX
- in buildlink3.mk bump minimum required pkgsrc Perl version to
5.12.0
- placate some pkglint warnings

Upstream changes:
- From version 5.12.1 announce

This release contains minor bug fixes and updates of several core
modules, as well as minor documentation updates. It should be fully
backward compatible with Perl 5.12.0.

- From version 5.12.0 announce:

Perl 5.12.0 represents approximately two years of development since
version 5.10.0 and contains over 750,000 lines of changes across over
3,000 files from over 200 authors and committers.

[...]

Notable changes in Perl 5.12 include:

* Perl now conforms much more closely to the Unicode standard.
  Additionally, this release includes an upgrade to version
  5.2 of the standard.

* New experimental APIs allow developers to extend Perl with
  "pluggable" keywords and syntax.

* Perl now has a better sense of time and will be able to keep
  accurate time well past the "Y2038" barrier.

* New syntax allows developers to specify package version numbers
  directly in "package" statements

* Perl now warns the user about the use of deprecated features
  by default.

- For a complete list of changes see included perl5120delta(1) and
perl5121delta(1) or http://perldoc.perl.org/perl5120delta.html and
http://perldoc.perl.org/perl5121delta.html
This commit is contained in:
seb 2010-08-19 20:47:09 +00:00
parent 107c8a34aa
commit 25df3b7208
14 changed files with 224 additions and 1018 deletions

View file

@ -1,10 +1,10 @@
# $NetBSD: Makefile,v 1.159 2010/06/27 13:38:39 spz Exp $
# $NetBSD: Makefile,v 1.160 2010/08/19 20:47:09 seb Exp $
.include "license.mk"
DISTNAME= perl-5.10.1
DISTNAME= perl-5.12.1
CATEGORIES= lang devel perl5
PKGREVISION= 2
#PKGREVISION= 1
MASTER_SITES= ${MASTER_SITE_PERL_CPAN:S,/modules/by-module/$,/src/5.0/,}
DISTFILES+= ${DISTNAME}${EXTRACT_SUFX}
@ -69,63 +69,35 @@ PERL5_SITELIB= ${PERL5_SITEBASE}/lib/perl5/site_perl/${PERL5_API_VERS}
HAS_CONFIGURE= yes
CONFIGURE_SCRIPT= ./Configure
CONFIGURE_ARGS+= -sde
CONFIGURE_ARGS+= -Darchname="${MACHINE_ARCH}-${LOWER_OPSYS}"
CONFIGURE_ARGS+= -Dcc=${CC:Q}
CONFIGURE_ARGS+= -Doptimize=${CFLAGS:M*:Q}
CONFIGURE_ARGS+= -Ui_malloc
CONFIGURE_ARGS+= -Uinstallusrbinperl
MAKE_ENV+= LC_ALL="C"
TEST_TARGET= test
###
### Installation directories for "perl", "vendor" and "site" bits.
###
CONFIGURE_ARGS+= -Dinstallstyle="lib/perl5"
CONFIGURE_ARGS+= -Dprefix=${PERL5_PREFIX:Q}
CONFIGURE_ARGS+= -Dsiteprefix=${PERL5_SITEPREFIX:Q}
CONFIGURE_ARGS+= -Dvendorprefix=${PERL5_VENDORPREFIX:Q}
# The Perl Configure script will install scripts into "*/script"
# directories if they exist, so override with explicit settings.
#
# Policy.sh generation
# (see comments in files/Policy.sh)
SUBST_CLASSES+= policysh
SUBST_STAGE.policysh= pre-configure
SUBST_FILES.policysh= Policy.sh
SUBST_VARS.policysh+= MACHINE_ARCH
SUBST_VARS.policysh+= LOWER_OPSYS
SUBST_VARS.policysh+= CC
SUBST_VARS.policysh+= CFLAGS
SUBST_VARS.policysh+= PERL5_PREFIX
SUBST_VARS.policysh+= PERL5_SITEPREFIX
SUBST_VARS.policysh+= PERL5_VENDORPREFIX
PERL5_SCRIPTDIR= ${PERL5_PERLBASE}/bin
CONFIGURE_ARGS+= -Dscriptdir=${PERL5_SCRIPTDIR:Q}
CONFIGURE_ARGS+= -Dsitescript=${PERL5_SITEBASE:Q}/bin
CONFIGURE_ARGS+= -Dvendorscript=${PERL5_VENDORBASE:Q}/bin
# Put any compiled binaries into vendor- and site-specific locations to
# avoid conflicts with each other. The perllink script will handle all
# the appropriate symlinking.
#
CONFIGURE_ARGS+= -Dsitebin=${PERL5_SITEBASE:Q}/bin
CONFIGURE_ARGS+= -Dvendorbin=${PERL5_VENDORBASE:Q}/bin
# Put the API-specific files into API-specific directories instead
# of the default version-specific directories.
#
CONFIGURE_ARGS+= -Dprivlib=${PERL5_PRIVLIB:Q}
CONFIGURE_ARGS+= -Dsitelib=${PERL5_SITELIB:Q}
CONFIGURE_ARGS+= -Dvendorlib=${PERL5_VENDORLIB:Q}
# Search for version-specific directories under these directories.
CONFIGURE_ARGS+= -Dsitelib_stem=${PERL5_SITEBASE:Q}
CONFIGURE_ARGS+= -Dvendorlib_stem=${PERL5_VENDORBASE:Q}
# Avoid manpage conflicts between the standard Perl library, 3rd-party
# modules, and other packages.
#
SUBST_VARS.policysh+= PERL5_SCRIPTDIR
SUBST_VARS.policysh+= PERL5_PERLBASE
SUBST_VARS.policysh+= PERL5_SITEBASE
SUBST_VARS.policysh+= PERL5_VENDORBASE
SUBST_VARS.policysh+= PERL5_PRIVLIB
SUBST_VARS.policysh+= PERL5_SITELIB
SUBST_VARS.policysh+= PERL5_VENDORLIB
PERL5_MAN1DIR= ${PERL5_PERLBASE}/${PKGMANDIR}/man1
CONFIGURE_ARGS+= -Dman1ext="1"
CONFIGURE_ARGS+= -Dman1dir=${PERL5_MAN1DIR:Q}
CONFIGURE_ARGS+= -Dsiteman1dir=${PERL5_SITEBASE:Q}/${PKGMANDIR:Q}/man1
CONFIGURE_ARGS+= -Dvendorman1dir=${PERL5_VENDORBASE:Q}/${PKGMANDIR:Q}/man1
CONFIGURE_ARGS+= -Dman3ext="3"
CONFIGURE_ARGS+= -Dman3dir=${PERL5_PERLBASE:Q}/${PKGMANDIR:Q}/man3
CONFIGURE_ARGS+= -Dsiteman3dir=${PERL5_SITEBASE:Q}/${PKGMANDIR:Q}/man3
CONFIGURE_ARGS+= -Dvendorman3dir=${PERL5_VENDORBASE:Q}/${PKGMANDIR:Q}/man3
SUBST_VARS.policysh+= PERL5_MAN1DIR
SUBST_VARS.policysh+= PKGMANDIR
SUBST_VARS.policysh+= LOCALBASE
SUBST_VARS.policysh+= PTHREAD_LDFLAGS
.if ${OPSYS} == "Darwin"
#
@ -149,13 +121,13 @@ CONFIGURE_ARGS+= -Duseshrplib
# files, so make sure the paths to the ones in ${TOOLS_DIR} aren't used.
#
USE_TOOLS+= hostname ln sed test
CONFIGURE_ARGS+= -Daphostname=${TOOLS_HOSTNAME_CMD:Q}
CONFIGURE_ARGS+= -Dln=${TOOLS_LN:Q}
CONFIGURE_ARGS+= -Dsed=${TOOLS_SED:Q}
SUBST_VARS.policysh+= TOOLS_HOSTNAME_CMD
SUBST_VARS.policysh+= TOOLS_LN
TOOLS_ALIASES.sed+= ${TOOLS_SED:T}
CONFIGURE_ARGS+= -Dsh=${TOOLS_SH:Q}
CONFIGURE_ARGS+= -Dissymlink="${TOOLS_TEST} -h"
CONFIGURE_ARGS+= -Dperl5=${FALSE}
SUBST_VARS.policysh+= TOOLS_SED
SUBST_VARS.policysh+= TOOLS_SH
SUBST_VARS.policysh+= TOOLS_TEST
SUBST_VARS.policysh+= FALSE
# Nail down the needed libraries for each platform here to avoid hidden
# dependencies. If this isn't defined, then use the perl defaults for the
@ -164,14 +136,16 @@ CONFIGURE_ARGS+= -Dperl5=${FALSE}
LIBSWANTED.Darwin= m c
LIBSWANTED.DragonFly= m crypt
LIBSWANTED.FreeBSD= m crypt
LIBSWANTED.HPUX= cl pthread $$libswanted # see Perl's README.hpux
LIBSWANTED.IRIX= m crypt
LIBSWANTED.Interix= m dl
LIBSWANTED.Linux= m crypt dl nsl
LIBSWANTED.NetBSD= m crypt
LIBSWANTED.OpenBSD= m crypt
LIBSWANTED.SunOS= m crypt dl socket nsl
LIBSWANTED.AIX= m crypt dl socket nsl bind c
LIBSWANTED.AIX= m crypt dl socket nsl bind c
LIBSWANTED= ${LIBSWANTED.${OPSYS}}
SUBST_VARS.policysh+= LIBSWANTED
# Nail down the directories in which the system libraries may be found.
# If this isn't defined, then use the perl defaults for the particular
@ -186,21 +160,16 @@ SYSLIBPATH.OpenBSD= /usr/lib
SYSLIBPATH.SunOS= /usr/lib
SYSLIBPATH.AIX= /usr/lib
SYSLIBPATH= ${SYSLIBPATH.${OPSYS}}
# Nail down the directories in which headers and libraries of
# locally-installed software may be found.
#
LOCLIBPATH= ${LOCALBASE}/lib
LOCINCPATH= ${LOCALBASE}/include
SUBST_VARS.policysh+= SYSLIBPATH
# On a.out platforms, we link with "ld" and on ELF platforms, we link with
# "cc", so we need to use different options to pass the run-time search path
# flags to the link command in the right way.
#
.if ${OBJECT_FMT} == "a.out"
LOCLIBRPATHFLAGS= ${LOCLIBPATH:S/^/${LINKER_RPATH_FLAG} /g}
LOCLIBRPATHFLAGS= ${LINKER_RPATH_FLAG} ${LOCALBASE}/lib
.elif ${OBJECT_FMT} == "ELF" || ${OBJECT_FMT} == "XCOFF"
LOCLIBRPATHFLAGS= ${LOCLIBPATH:S/^/${COMPILER_RPATH_FLAG}/g}
LOCLIBRPATHFLAGS= ${COMPILER_RPATH_FLAG}${LOCALBASE}/lib
.else
LOCLIBRPATHFLAGS= # empty
.endif
@ -283,34 +252,31 @@ CONFIGURE_ARGS+= -Uusemymalloc
.if !empty(PKG_OPTIONS:M64bitint)
CONFIGURE_ARGS+= -Duse64bitint
.if ${OBJECT_FMT} == "XCOFF"
. if ${OBJECT_FMT} == "XCOFF"
LOCLIBRPATHFLAGS+= ${COMPILER_RPATH_FLAG}${PERL5_PRIVLIB}/${MACHINE_ARCH}-${LOWER_OPSYS}${PERL5_RPATH_THREAD}-multi-64int/CORE
.endif
. endif
.elif !empty(PKG_OPTIONS:M64bitmore)
CONFIGURE_ARGS+= -Dusemorebits
.if ${OBJECT_FMT} == "XCOFF"
. if ${OBJECT_FMT} == "XCOFF"
LOCLIBRPATHFLAGS+= ${COMPILER_RPATH_FLAG}${PERL5_PRIVLIB}/${MACHINE_ARCH}-${LOWER_OPSYS}${PERL5_RPATH_THREAD}-multi-64int-ld/CORE
.endif
. endif
.elif !empty(PKG_OPTIONS:M64bitall)
CONFIGURE_ARGS+= -Duse64bitall
.if ${OBJECT_FMT} == "XCOFF"
. if ${OBJECT_FMT} == "XCOFF"
LOCLIBRPATHFLAGS+= ${COMPILER_RPATH_FLAG}${PERL5_PRIVLIB}/${MACHINE_ARCH}-${LOWER_OPSYS}${PERL5_RPATH_THREAD}-multi-64all/CORE
.endif
. endif
.elif !empty(PKG_OPTIONS:M64bitnone)
CONFIGURE_ARGS+= -Uuse64bitall -Uusemorebits -Uuse64bitint
.if ${OBJECT_FMT} == "XCOFF"
. if ${OBJECT_FMT} == "XCOFF"
LOCLIBRPATHFLAGS+= ${COMPILER_RPATH_FLAG}${PERL5_PRIVLIB}/${MACHINE_ARCH}-${LOWER_OPSYS}${PERL5_RPATH_THREAD}-multi/CORE
.endif
. endif
.else
.if ${OBJECT_FMT} == "XCOFF"
. if ${OBJECT_FMT} == "XCOFF"
BROKEN= XCOFF targets need the path specified where libperl.a resides.\
Please choose on of 64bitint 64bitmore 64bitall or 64bitnone to allow this.
. endif
.endif
.endif
.if !empty(LIBSWANTED)
CONFIGURE_ARGS+= -Dlibswanted=${LIBSWANTED:Q}
.endif
SUBST_VARS.policysh+= LOCLIBRPATHFLAGS
# Remove a spurious workdir reference
SUBST_CLASSES+= rm
@ -319,11 +285,10 @@ SUBST_FILES.rm= lib/Config_heavy.pl
SUBST_SED.rm= -e "s!^rm_try='/.*/\.tools/bin/rm -f!rm_try='/bin/rm -f!"
# Replace our perl as the interpreter
REPLACE_PERL+= lib/Class/ISA.pm
REPLACE_PERL+= lib/File/DosGlob.pm
REPLACE_PERL+= lib/version.pm
REPLACE_PERL+= lib/Math/BigFloat/Trace.pm
REPLACE_PERL+= lib/Math/BigInt/Trace.pm
REPLACE_PERL+= cpan/bignum/lib/Math/BigFloat/Trace.pm
REPLACE_PERL+= cpan/bignum/lib/Math/BigInt/Trace.pm
REPLACE_PERL+= lib/unicore/mktables
# And replace a perl interpreter during the pre-install stage
@ -338,11 +303,11 @@ SUBST_SED.miniperl= -e "1s:\#!./miniperl:\#!${PERL5}:"
SUBST_CLASSES+= cpprun
SUBST_STAGE.cpprun= pre-install
SUBST_FILES.cpprun= lib/Config_heavy.pl
.if !empty(PKG_OPTIONS:Mthreads)
. if !empty(PKG_OPTIONS:Mthreads)
SUBST_SED.cpprun= -e "s/cpprun=''/cpprun='cc_r -E'/"
.else
. else
SUBST_SED.cpprun= -e "s/cpprun=''/cpprun='cc -E'/"
.endif
. endif
.endif
# Some platforms may want the directory mode not to be 0755. This
@ -351,65 +316,12 @@ SUBST_SED.cpprun= -e "s/cpprun=''/cpprun='cc -E'/"
#
SUBST_CLASSES+= dirmode
SUBST_STAGE.dirmode= post-patch
SUBST_FILES.dirmode= installhtml installman installperl \
lib/ExtUtils/Install.pm
SUBST_FILES.dirmode= installhtml install_lib.pl \
dist/ExtUtils-Install/lib/ExtUtils/Install.pm
SUBST_SED.dirmode= -e "s/755/${PKGDIRMODE}/g;/umask(/d"
# It's tough to guess which hints file will be used, so add our modifications
# to all of them:
#
# - Add the pkgsrc-derived LDFLAGS for linking against pthreads to the
# usethreads.cbu call-back script.
#
# - Generate a pkgsrc.cbu call-back script that sets the correct LDFLAGS
# for linking against pkgsrc-installed libraries.
#
# - Explicitly set the local compiler search paths to contain only the
# pkgsrc-controlled directories.
#
pre-configure:
.if defined(PTHREAD_LDFLAGS) && !empty(PTHREAD_LDFLAGS)
hintdir="${WRKSRC}/hints"; \
for hints in $${hintdir}/*.sh; do \
${CHMOD} +w $${hints}; \
{ ${ECHO} ""; \
${ECHO} "cat >> UU/usethreads.cbu <<'EOCBU'"; \
${ECHO} ""; \
${ECHO} "# Add pkgsrc-derived ldflags to link with thread support."; \
${ECHO} 'ldflags="'${PTHREAD_LDFLAGS:Q}' $$ldflags"'; \
${ECHO} 'lddlflags="'${PTHREAD_LDFLAGS:Q}' $$lddlflags"'; \
${ECHO} "EOCBU"; \
} >> $${hints}; \
done
.endif
hintdir="${WRKSRC}/hints"; \
for hints in $${hintdir}/*.sh; do \
${CHMOD} +w $${hints}; \
{ ${ECHO} ""; \
${ECHO} "cat > UU/pkgsrc.cbu <<'EOCBU'"; \
${ECHO} "# This script UU/pkgsrc.cbu will get 'called-back' by Configure to set"; \
${ECHO} '# linker options after all other call-back scripts have been invoked.'; \
${ECHO} 'ldflags="'${LOCLIBRPATHFLAGS:Q}' $$ldflags"'; \
${ECHO} 'lddlflags="'${LOCLIBRPATHFLAGS:Q}' $$lddlflags"'; \
${ECHO} "EOCBU"; \
} >> $${hints}; \
done
hintdir="${WRKSRC}/hints"; \
for hints in $${hintdir}/*.sh; do \
${CHMOD} +w $${hints}; \
{ ${ECHO} ""; \
${ECHO} "# Set pkgsrc defaults for library and header search paths."; \
${ECHO} 'locincpth="'${LOCINCPATH:Q}'"'; \
${ECHO} 'loclibpth="'${LOCLIBPATH:Q}'"'; \
} >> $${hints}; \
done
.if !empty(SYSLIBPATH)
hintdir="${WRKSRC}/hints"; \
for hints in $${hintdir}/*.sh; do \
${CHMOD} +w $${hints}; \
${ECHO} 'glibpth="'${SYSLIBPATH:Q}'"' >> $${hints}; \
done
.endif
post-extract:
cp ${FILESDIR}/Policy.sh ${WRKSRC}/Policy.sh
post-build:
${SED} -e "s,@PERL5@,"${PERL5:Q}",g" \
@ -429,10 +341,10 @@ PLIST_SRC= ${WRKDIR}/.PLIST_SRC
post-install: perl5-post-install
perl5-post-install:
if ${TEST} -x ${DESTDIR}${PREFIX}/bin/a2p; then \
${RUN}if ${TEST} -x ${DESTDIR}${PREFIX}/bin/a2p; then \
strip ${DESTDIR}${PREFIX}/bin/a2p; \
fi
${INSTALL_SCRIPT} ${WRKDIR}/perllink.sh ${DESTDIR}${PERL5_SCRIPTDIR}/perllink; \
${RUN}${INSTALL_SCRIPT} ${WRKDIR}/perllink.sh ${DESTDIR}${PERL5_SCRIPTDIR}/perllink; \
${INSTALL_MAN} ${FILESDIR}/perllink.1 ${DESTDIR}${PERL5_MAN1DIR}/perllink.1; \
${RM} -f ${DESTDIR}${PREFIX}/bin/perllink \
${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/perllink.1; \

View file

@ -1,4 +1,4 @@
# $NetBSD: buildlink3.mk,v 1.45 2009/07/17 06:43:27 sno Exp $
# $NetBSD: buildlink3.mk,v 1.46 2010/08/19 20:47:09 seb Exp $
BUILDLINK_TREE+= perl
@ -6,13 +6,13 @@ BUILDLINK_TREE+= perl
PERL5_BUILDLINK3_MK:=
.include "../../mk/bsd.fast.prefs.mk"
PERL5_REQD+= 5.10.0
PERL5_REQD+= 5.12.0
.for _perl5_ver_ in ${PERL5_REQD}
BUILDLINK_API_DEPENDS.perl+= perl>=${_perl5_ver_}
.endfor
# Prevent p5-* etc. packages built for 5.10.0 to be used
# Prevent p5-* etc. packages built for 5.12.0 to be used
# with the next incompatible version of perl:
BUILDLINK_API_DEPENDS.perl+= perl<5.12.0
BUILDLINK_API_DEPENDS.perl+= perl<5.14.0
BUILDLINK_PKGSRCDIR.perl?= ../../lang/perl5
@ -24,21 +24,19 @@ pkgbase := perl
.include "../../mk/pkg-build-options.mk"
PERL5_OPTIONS?= # empty
. if !empty(PERL5_OPTIONS:Mthreads)
.if !empty(PERL5_OPTIONS:Mthreads)
INSTALL_TEMPLATES+= ${.CURDIR}/../../lang/perl5/files/install_threads.tmpl
. endif
.endif
. if ${PKG_INSTALLATION_TYPE} == "overwrite"
.if ${PKG_INSTALLATION_TYPE} == "overwrite"
#
# Perl keeps headers and odd libraries in an odd path not caught by the
# default BUILDLINK_FILES_CMD, so name them to be symlinked into
# ${BUILDLINK_DIR}.
#
.include "../../lang/perl5/vars.mk"
BUILDLINK_FILES.perl= \
${PERL5_SUB_INSTALLARCHLIB}/CORE/* \
${PERL5_SUB_INSTALLARCHLIB}/auto/DynaLoader/DynaLoader.a
. endif
BUILDLINK_FILES.perl= ${PERL5_SUB_INSTALLARCHLIB}/CORE/*
.endif
.endif # PERL5_BUILDLINK3_MK
BUILDLINK_TREE+= -perl

View file

@ -1,24 +1,18 @@
$NetBSD: distinfo,v 1.65 2010/06/27 13:38:39 spz Exp $
$NetBSD: distinfo,v 1.66 2010/08/19 20:47:09 seb Exp $
SHA1 (perl-5.10.1.tar.gz) = 8536ed1c14444d1efea069525a816fbc7be7109f
RMD160 (perl-5.10.1.tar.gz) = 6fe727a5e8878c26b5bd7cfc7165e10f311f7214
Size (perl-5.10.1.tar.gz) = 14117518 bytes
SHA1 (patch-aa) = 7f25db6568bb1b0d079efde82952b2fea919b7f8
SHA1 (perl-5.12.1.tar.gz) = 83b99f08379782dc06594a85eeb279edc5b0ca44
RMD160 (perl-5.12.1.tar.gz) = 2e2d08821bdf3ed87360af828e3b31f5861b4fdd
Size (perl-5.12.1.tar.gz) = 15122057 bytes
SHA1 (patch-aa) = 4c8197cdc0595a17ba377a28c7457f923c2d9bf9
SHA1 (patch-ab) = e3aa6bf9695addb9b754297120caf8683a625d1a
SHA1 (patch-ac) = c1893ea4cf4b89b03b3acc5dec9b5828d50c5dad
SHA1 (patch-ah) = 1d2f4049dcc8dafcd0eafad36a74531dc7f305c9
SHA1 (patch-ah) = 7f4c84249cb804af69db389078f7b7cbfc97896c
SHA1 (patch-ai) = 5abdbbddcba79088996056ab88a34db5fcd16b01
SHA1 (patch-aq) = 3ece22678e3e6dcd3cf641e6389ff203cbe351b9
SHA1 (patch-ba) = 956faac66f446b05360be16b5d197280dea7f801
SHA1 (patch-ca) = bc3472f62773045916261e8e434af8f2e25b4f9a
SHA1 (patch-ch) = 5b6a89c82e158bab0a5f06add48c28e600678099
SHA1 (patch-ci) = e99836c538257f45917c3fb81f9c4d07df2e58e7
SHA1 (patch-ck) = 28207b8186c9ad194a1edc696159915bc16d1097
SHA1 (patch-cn) = 7ca2b1ff19f8371637a34ec26779b37d74c74cca
SHA1 (patch-co) = c4a4e30171cebb1ceaa14850b9be99ffa7c94519
SHA1 (patch-db) = 3aef75518bfea88cb5166026f04ef4d7c016bc99
SHA1 (patch-fa) = 0a496df9e340291a6162efb1b63b0420c2559be8
SHA1 (patch-ta) = 69f0d2df022eb8ff0dbcc77bde638cdc9c6391b1
SHA1 (patch-zc) = a23002397ffaebb243f7683c95c8fb227af90f49
SHA1 (patch-zd) = 1a4ae60e9ae350c813d8b91c61e93805b3e66210
SHA1 (patch-zc) = 187b79978285058f37991278b99bbd4109344a2f
SHA1 (patch-zd) = 15532739b4a582da322d3e51fc364905bacbcd7e
SHA1 (patch-ze) = 42ccdd60c8dc5c6e93ebcebd276aa5f7e60d07fe

120
lang/perl5/files/Policy.sh Normal file
View file

@ -0,0 +1,120 @@
# $NetBSD: Policy.sh,v 1.1 2010/08/19 20:47:10 seb Exp $
#
# Site-wide policy settings for pkgsrc Perl
#
archname='@MACHINE_ARCH@-@LOWER_OPSYS@'
cc='@CC@'
if $test -n '@CFLAGS@'; then
optimize='@CFLAGS@'
fi
i_malloc='undef'
installusrbinperl='undef'
installstyle='lib/perl5'
# Perl embeds the full paths to the following tools in several installed
# files, so make sure the paths to the ones in ${TOOLS_DIR} aren't used.
aphostname='@TOOLS_HOSTNAME_CMD@'
ln='@TOOLS_LN@'
lns='@TOOLS_LN@ -s'
sed='@TOOLS_SED@'
sh='@TOOLS_SH@'
issymlink='@TOOLS_TEST@ -h'
perl5='@FALSE@'
# Installation directories for "perl", "vendor" and "site" bits.
prefix='@PERL5_PREFIX@'
siteprefix='@PERL5_SITEPREFIX@'
vendorprefix='@PERL5_VENDORPREFIX@'
# The Perl Configure script will install scripts into "*/script"
# directories if they exist, so override with explicit settings.
scriptdir='@PERL5_SCRIPTDIR@'
sitescript='@PERL5_SITEBASE@/bin'
vendorscript='@PERL5_VENDORBASE@/bin'
# Put any compiled binaries into vendor- and site-specific locations to
# avoid conflicts with each other. The perllink script will handle all
# the appropriate symlinking.
sitebin='@PERL5_SITEBASE@/bin'
vendorbin='@PERL5_VENDORBASE@/bin'
# Put the API-specific files into API-specific directories instead
# of the default version-specific directories.
privlib='@PERL5_PRIVLIB@'
sitelib='@PERL5_SITELIB@'
vendorlib='@PERL5_VENDORLIB@'
# Search for version-specific directories under these directories.
sitelib_stem='@PERL5_SITEBASE@'
vendorlib_stem='@PERL5_VENDORBASE@'
# Avoid manpage conflicts between the standard Perl library, 3rd-party
# modules, and other packages.
man1ext='1'
man1dir='@PERL5_MAN1DIR@'
siteman1dir='@PERL5_SITEBASE@/@PKGMANDIR@/man1'
vendorman1dir='@PERL5_VENDORBASE@/@PKGMANDIR@/man1'
man3ext='3'
man3dir='@PERL5_PERLBASE@/@PKGMANDIR@/man3'
siteman3dir='@PERL5_SITEBASE@/@PKGMANDIR@/man3'
vendorman3dir='@PERL5_VENDORBASE@/@PKGMANDIR@/man3'
# Nail down the needed libraries for each platform here to avoid hidden
# dependencies. If this isn't defined, then use the perl defaults for the
# particular operating system.
if $test -n "@LIBSWANTED@"; then
libswanted="@LIBSWANTED@ "
fi
# Add the pkgsrc-derived LDFLAGS for linking against pthreads to the
# usethreads.cbu call-back script
if $test -n "@PTHREAD_LDFLAGS@"; then
cat >> UU/usethreads.cbu <<EOCBU
# Add pkgsrc-derived ldflags to link with thread support.
ldflags="@PTHREAD_LDFLAGS@ \$ldflags"
lddlflags="@PTHREAD_LDFLAGS@ \$lddlflags"
EOCBU
fi
# Generate a pkgsrc.cbu call-back script that sets the correct LDFLAGS
# for linking against pkgsrc-installed libraries
cat > UU/pkgsrc.cbu <<EOCBU
# This script UU/pkgsrc.cbu will get 'called-back' by Configure
# *after* all hints
# Sets the correct LDFLAGS for linking against pkgsrc-installed
# libraries
ldflags="@LOCLIBRPATHFLAGS@ \$ldflags"
lddlflags="@LOCLIBRPATHFLAGS@ \$lddlflags"
# Set pkgsrc defaults for library and header search paths:
# nail down the directories in which headers and libraries of
# locally-installed software may be found.
loclibpth="@LOCALBASE@/lib"
locincpth="@LOCALBASE@/include"
# Set pkgsrc defaults for "plateform"/general path used to
# find libraries
if $test -n "@SYSLIBPATH@"; then
glibpth="@SYSLIBPATH@"
fi
# Strip /usr/local/lib... from ldflags
case "\$ldflags" in */usr/local/lib*)
set \`echo "X \$ldflags " | sed 's, [^ ]*/usr/local/lib[^ ]* , ,g'\`
shift
ldflags="\$*"
;;
esac
# Strip gdbm from libswanted
case "\$libswanted" in *gdbm*)
set \`echo "X \$libswanted " | sed 's, [^ ]*gdbm[^ ]* , ,g'\`
shift
libswanted="\$*"
esac
# (re)Set sed here so that sed _and_ full_sed are correctly *both* set
sed='@TOOLS_SED@'
EOCBU

View file

@ -1,7 +1,7 @@
$NetBSD: patch-aa,v 1.32 2009/12/14 06:36:57 seb Exp $
$NetBSD: patch-aa,v 1.33 2010/08/19 20:47:10 seb Exp $
--- lib/ExtUtils/MM_Unix.pm.orig 2009-12-06 17:10:46.000000000 +0000
+++ lib/ExtUtils/MM_Unix.pm 2009-12-06 17:12:37.000000000 +0000
--- cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm.orig 2010-05-21 03:45:50.000000000 +0000
+++ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm 2010-05-21 03:46:44.000000000 +0000
@@ -28,8 +28,6 @@
$Is{VMS} = $^O eq 'VMS';
$Is{OSF} = $^O eq 'dec_osf';

View file

@ -1,18 +0,0 @@
$NetBSD: patch-ac,v 1.14 2009/12/22 04:39:59 dsainty Exp $
We intentionally wire down the 'libswanted' list in the package Makefile,
so don't let the hints file add new libraries that may be found outside
Pkgsrc control.
--- hints/linux.sh 2009-02-13 11:58:12.000000000 +1300
+++ hints/linux.sh 2009-12-22 16:46:41.400187863 +1300
@@ -54,9 +54,6 @@
shift
libswanted="$*"
-# Debian 4.0 puts ndbm in the -lgdbm_compat library.
-libswanted="$libswanted gdbm_compat"
-
# If you have glibc, then report the version for ./myconfig bug reporting.
# (Configure doesn't need to know the specific version since it just uses
# gcc to load the library for all tests.)

View file

@ -1,8 +1,6 @@
$NetBSD: patch-ah,v 1.10 2008/10/10 21:58:43 he Exp $
--- perl.c.orig 2007-12-18 11:47:08.000000000 +0100
+++ perl.c
@@ -1454,8 +1454,10 @@ S_procself_val(pTHX_ SV *sv, const char
--- perl.c.orig 2010-05-21 14:41:18.000000000 +0000
+++ perl.c 2010-05-21 14:44:01.000000000 +0000
@@ -1414,8 +1414,10 @@
to the executable (or returning an error from the readlink). Any valid
path has a '/' in it somewhere, so use that to validate the result.
See http://www.freebsd.org/cgi/query-pr.cgi?pr=35703
@ -14,94 +12,3 @@ $NetBSD: patch-ah,v 1.10 2008/10/10 21:58:43 he Exp $
sv_setpvn(sv,buf,len);
}
else {
@@ -4747,45 +4749,8 @@ S_init_perllib(pTHX)
}
/* Use the ~-expanded versions of APPLLIB (undocumented),
- ARCHLIB PRIVLIB SITEARCH SITELIB VENDORARCH and VENDORLIB
+ SITEARCH SITELIB VENDORARCH VENDORLIB ARCHLIB and PRIVLIB
*/
-#ifdef APPLLIB_EXP
- incpush(APPLLIB_EXP, TRUE, TRUE, TRUE, TRUE);
-#endif
-
-#ifdef ARCHLIB_EXP
- incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE, TRUE);
-#endif
-#ifdef MACOS_TRADITIONAL
- {
- Stat_t tmpstatbuf;
- SV * privdir = newSV(0);
- char * macperl = PerlEnv_getenv("MACPERL");
-
- if (!macperl)
- macperl = "";
-
- Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
- if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
- incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
- Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
- if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
- incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
-
- SvREFCNT_dec(privdir);
- }
- if (!PL_tainting)
- incpush(":", FALSE, FALSE, TRUE, FALSE);
-#else
-#ifndef PRIVLIB_EXP
-# define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
-#endif
-#if defined(WIN32)
- incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE, TRUE);
-#else
- incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE, TRUE);
-#endif
-
#ifdef SITEARCH_EXP
/* sitearch is always relative to sitelib on Windows for
* DLL-based path intuition to work correctly */
@@ -4828,6 +4793,43 @@ S_init_perllib(pTHX)
incpush(PERL_VENDORLIB_STEM, FALSE, TRUE, TRUE, TRUE);
#endif
+#ifdef APPLLIB_EXP
+ incpush(APPLLIB_EXP, TRUE, TRUE, TRUE, TRUE);
+#endif
+
+#ifdef ARCHLIB_EXP
+ incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE, TRUE);
+#endif
+#ifdef MACOS_TRADITIONAL
+ {
+ Stat_t tmpstatbuf;
+ SV * privdir = newSV(0);
+ char * macperl = PerlEnv_getenv("MACPERL");
+
+ if (!macperl)
+ macperl = "";
+
+ Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
+ if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
+ incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
+ Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
+ if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
+ incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
+
+ SvREFCNT_dec(privdir);
+ }
+ if (!PL_tainting)
+ incpush(":", FALSE, FALSE, TRUE, FALSE);
+#else
+#ifndef PRIVLIB_EXP
+# define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
+#endif
+#if defined(WIN32)
+ incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE, TRUE);
+#else
+ incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE, TRUE);
+#endif
+
#ifdef PERL_OTHERLIBDIRS
incpush(PERL_OTHERLIBDIRS, TRUE, TRUE, TRUE, TRUE);
#endif

View file

@ -1,28 +0,0 @@
$NetBSD: patch-ba,v 1.6 2009/12/14 06:36:57 seb Exp $
--- hints/netbsd.sh.orig 2009-12-06 17:21:43.000000000 +0000
+++ hints/netbsd.sh 2009-12-06 17:22:01.000000000 +0000
@@ -175,23 +175,6 @@
esac
EOCBU
-# Set sensible defaults for NetBSD: look for local software in
-# /usr/pkg (NetBSD Packages Collection) and in /usr/local.
-#
-loclibpth="/usr/pkg/lib /usr/local/lib"
-locincpth="/usr/pkg/include /usr/local/include"
-case "$rpathflag" in
-'')
- ldflags=
- ;;
-*)
- ldflags=
- for yyy in $loclibpth; do
- ldflags="$ldflags $rpathflag$yyy"
- done
- ;;
-esac
-
case `uname -m` in
alpha)
echo 'int main() {}' > try.c

View file

@ -1,21 +0,0 @@
$NetBSD: patch-ci,v 1.6 2009/12/14 06:36:57 seb Exp $
--- pp_sys.c.orig 2009-12-06 17:53:56.000000000 +0000
+++ pp_sys.c 2009-12-06 17:55:04.000000000 +0000
@@ -4463,12 +4463,15 @@
when = (Time_t)SvIVx(POPs);
#endif
- if (PL_op->op_type == OP_LOCALTIME)
+ if (PL_op->op_type == OP_LOCALTIME) {
#ifdef LOCALTIME_EDGECASE_BROKEN
tmbuf = S_my_localtime(aTHX_ &when);
#else
+ /* Explicitly invoke tzset() as localtime_r may not. */
+ tzset();
tmbuf = localtime(&when);
#endif
+ }
else
tmbuf = gmtime(&when);

View file

@ -1,28 +0,0 @@
$NetBSD: patch-co,v 1.4 2009/12/14 06:36:57 seb Exp $
--- hints/freebsd.sh.orig 2009-12-06 18:06:01.000000000 +0000
+++ hints/freebsd.sh 2009-12-06 18:06:31.000000000 +0000
@@ -114,7 +114,7 @@
lddlflags="-Bshareable $lddlflags"
;;
-*)
+3*|4*|5*|6*)
objformat=`/usr/bin/objformat`
if [ x$objformat = xaout ]; then
if [ -e /usr/lib/aout ]; then
@@ -130,6 +130,14 @@
fi
cccdlflags='-DPIC -fPIC'
;;
+
+*)
+ libpth="/usr/lib /usr/local/lib"
+ glibpth="/usr/lib /usr/local/lib"
+ ldflags="-Wl,-E "
+ lddlflags="-shared "
+ cccdlflags='-DPIC -fPIC'
+ ;;
esac
case "$osvers" in

View file

@ -1,73 +0,0 @@
$NetBSD: patch-db,v 1.1 2009/10/13 10:38:31 hasso Exp $
--- hints/dragonfly.sh.orig 2009-10-09 15:28:17 +0200
+++ hints/dragonfly.sh
@@ -19,18 +19,10 @@ esac
# out here to avoid duplicating them everywhere.
case "$osvers" in
*) objformat=`/usr/bin/objformat`
- if [ x$objformat = xelf ]; then
- libpth="/usr/lib /usr/local/lib"
- glibpth="/usr/lib /usr/local/lib"
- ldflags="-Wl,-E "
- lddlflags="-shared "
- else
- if [ -e /usr/lib/aout ]; then
- libpth="/usr/lib/aout /usr/local/lib /usr/lib"
- glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
- fi
- lddlflags='-Bshareable'
- fi
+ libpth="/usr/lib /usr/local/lib"
+ glibpth="/usr/lib /usr/local/lib"
+ ldflags="-Wl,-E "
+ lddlflags="-shared "
cccdlflags='-DPIC -fPIC'
;;
esac
@@ -67,43 +59,16 @@ d_voidsig='define'
cat > UU/usethreads.cbu <<'EOCBU'
case "$usethreads" in
$define|true|[yY]*)
- lc_r=`/sbin/ldconfig -r|grep ':-lc_r'|awk '{print $NF}'|sed -n '$p'`
case "$osvers" in
- *) if [ ! -r "$lc_r" ]; then
- cat <<EOM >&4
-POSIX threads should be supported by FreeBSD $osvers --
-but your system is missing the shared libc_r.
-(/sbin/ldconfig -r doesn't find any).
+ *) ldflags="-pthread $ldflags"
-Consider using the latest STABLE release.
-EOM
- exit 1
- fi
- case "$osvers" in
- *) ldflags="-pthread $ldflags"
- ;;
- esac
# Both in 4.x and 5.x gethostbyaddr_r exists but
# it is "Temporary function, not threadsafe"...
# Presumably earlier it didn't even exist.
d_gethostbyaddr_r="undef"
d_gethostbyaddr_r_proto="0"
- ;;
- esac
- set `echo X "$libswanted "| sed -e 's/ c / c_r /'`
- shift
- libswanted="$*"
- # Configure will probably pick the wrong libc to use for nm scan.
- # The safest quick-fix is just to not use nm at all...
- usenm=false
-
- unset lc_r
-
- # Even with the malloc mutexes the Perl malloc does not
- # seem to be threadsafe in FreeBSD?
- case "$usemymalloc" in
- '') usemymalloc=n ;;
+ ;;
esac
esac
EOCBU

View file

@ -1,565 +0,0 @@
$NetBSD: patch-fa,v 1.1 2010/06/27 13:38:39 spz Exp $
fixes CVE-2010-1168 and CVE-2010-1447 by updating Safe.pm to the current
version
--- ./ext/Safe/Safe.pm.orig 2009-08-22 18:39:32.000000000 +0000
+++ ./ext/Safe/Safe.pm
@@ -2,8 +2,9 @@ package Safe;
use 5.003_11;
use strict;
+use Scalar::Util qw(reftype);
-$Safe::VERSION = "2.18";
+$Safe::VERSION = "2.27";
# *** Don't declare any lexicals above this point ***
#
@@ -11,18 +12,18 @@ $Safe::VERSION = "2.18";
# see any lexicals in scope (apart from __ExPr__ which is unavoidable)
sub lexless_anon_sub {
- # $_[0] is package;
- # $_[1] is strict flag;
+ # $_[0] is package;
+ # $_[1] is strict flag;
my $__ExPr__ = $_[2]; # must be a lexical to create the closure that
- # can be used to pass the value into the safe
- # world
+ # can be used to pass the value into the safe
+ # world
# Create anon sub ref in root of compartment.
# Uses a closure (on $__ExPr__) to pass in the code to be executed.
# (eval on one line to keep line numbers as expected by caller)
eval sprintf
'package %s; %s strict; sub { @_=(); eval q[my $__ExPr__;] . $__ExPr__; }',
- $_[0], $_[1] ? 'use' : 'no';
+ $_[0], $_[1] ? 'use' : 'no';
}
use Carp;
@@ -30,6 +31,18 @@ BEGIN { eval q{
use Carp::Heavy;
} }
+use B ();
+BEGIN {
+ no strict 'refs';
+ if (defined &B::sub_generation) {
+ *sub_generation = \&B::sub_generation;
+ }
+ else {
+ # fake sub generation changing for perls < 5.8.9
+ my $sg; *sub_generation = sub { ++$sg };
+ }
+}
+
use Opcode 1.01, qw(
opset opset_to_ops opmask_add
empty_opset full_opset invert_opset verify_opset
@@ -38,6 +51,23 @@ use Opcode 1.01, qw(
*ops_to_opset = \&opset; # Temporary alias for old Penguins
+# Regular expressions and other unicode-aware code may need to call
+# utf8->SWASHNEW (via perl's utf8.c). That will fail unless we share the
+# SWASHNEW method.
+# Sadly we can't just add utf8::SWASHNEW to $default_share because perl's
+# utf8.c code does a fetchmethod on SWASHNEW to check if utf8.pm is loaded,
+# and sharing makes it look like the method exists.
+# The simplest and most robust fix is to ensure the utf8 module is loaded when
+# Safe is loaded. Then we can add utf8::SWASHNEW to $default_share.
+require utf8;
+# we must ensure that utf8_heavy.pl, where SWASHNEW is defined, is loaded
+# but without depending on knowledge of that implementation detail.
+# This code (//i on a unicode string) ensures utf8 is fully loaded
+# and also loads the ToFold SWASH.
+# (Swashes are cached internally by perl in PL_utf8_* variables
+# independent of being inside/outside of Safe. So once loaded they can be)
+do { my $a = pack('U',0xC4); my $b = chr 0xE4; utf8::upgrade $b; $a =~ /$b/i };
+# now we can safely include utf8::SWASHNEW in $default_share defined below.
my $default_root = 0;
# share *_ and functions defined in universal.c
@@ -57,10 +87,15 @@ my $default_share = [qw[
&utf8::downgrade
&utf8::native_to_unicode
&utf8::unicode_to_native
+ &utf8::SWASHNEW
$version::VERSION
$version::CLASS
+ $version::STRICT
+ $version::LAX
@version::ISA
-], ($] >= 5.008001 && qw[
+], ($] < 5.010 && qw[
+ &utf8::SWASHGET
+]), ($] >= 5.008001 && qw[
&Regexp::DESTROY
]), ($] >= 5.010 && qw[
&re::is_regexp
@@ -93,6 +128,12 @@ my $default_share = [qw[
&version::noop
&version::is_alpha
&version::qv
+ &version::vxs::declare
+ &version::vxs::qv
+ &version::vxs::_VERSION
+ &version::vxs::stringify
+ &version::vxs::new
+ &version::vxs::parse
]), ($] >= 5.011 && qw[
&re::regexp_pattern
])];
@@ -103,14 +144,14 @@ sub new {
bless $obj, $class;
if (defined($root)) {
- croak "Can't use \"$root\" as root name"
- if $root =~ /^main\b/ or $root !~ /^\w[:\w]*$/;
- $obj->{Root} = $root;
- $obj->{Erase} = 0;
+ croak "Can't use \"$root\" as root name"
+ if $root =~ /^main\b/ or $root !~ /^\w[:\w]*$/;
+ $obj->{Root} = $root;
+ $obj->{Erase} = 0;
}
else {
- $obj->{Root} = "Safe::Root".$default_root++;
- $obj->{Erase} = 1;
+ $obj->{Root} = "Safe::Root".$default_root++;
+ $obj->{Erase} = 1;
}
# use permit/deny methods instead till interface issues resolved
@@ -125,7 +166,9 @@ sub new {
# the whole glob *_ rather than $_ and @_ separately, otherwise
# @_ in non default packages within the compartment don't work.
$obj->share_from('main', $default_share);
+
Opcode::_safe_pkg_prep($obj->{Root}) if($Opcode::VERSION > 1.04);
+
return $obj;
}
@@ -140,7 +183,7 @@ sub erase {
my ($stem, $leaf);
no strict 'refs';
- $pkg = "main::$pkg\::"; # expand to full symbol table name
+ $pkg = "main::$pkg\::"; # expand to full symbol table name
($stem, $leaf) = $pkg =~ m/(.*::)(\w+::)$/;
# The 'my $foo' is needed! Without it you get an
@@ -149,7 +192,7 @@ sub erase {
#warn "erase($pkg) stem=$stem, leaf=$leaf";
#warn " stem_symtab hash ".scalar(%$stem_symtab)."\n";
- # ", join(', ', %$stem_symtab),"\n";
+ # ", join(', ', %$stem_symtab),"\n";
# delete $stem_symtab->{$leaf};
@@ -220,12 +263,12 @@ sub dump_mask {
}
-
sub share {
my($obj, @vars) = @_;
$obj->share_from(scalar(caller), \@vars);
}
+
sub share_from {
my $obj = shift;
my $pkg = shift;
@@ -236,26 +279,27 @@ sub share_from {
no strict 'refs';
# Check that 'from' package actually exists
croak("Package \"$pkg\" does not exist")
- unless keys %{"$pkg\::"};
+ unless keys %{"$pkg\::"};
my $arg;
foreach $arg (@$vars) {
- # catch some $safe->share($var) errors:
- my ($var, $type);
- $type = $1 if ($var = $arg) =~ s/^(\W)//;
- # warn "share_from $pkg $type $var";
- for (1..2) { # assign twice to avoid any 'used once' warnings
- *{$root."::$var"} = (!$type) ? \&{$pkg."::$var"}
- : ($type eq '&') ? \&{$pkg."::$var"}
- : ($type eq '$') ? \${$pkg."::$var"}
- : ($type eq '@') ? \@{$pkg."::$var"}
- : ($type eq '%') ? \%{$pkg."::$var"}
- : ($type eq '*') ? *{$pkg."::$var"}
- : croak(qq(Can't share "$type$var" of unknown type));
- }
+ # catch some $safe->share($var) errors:
+ my ($var, $type);
+ $type = $1 if ($var = $arg) =~ s/^(\W)//;
+ # warn "share_from $pkg $type $var";
+ for (1..2) { # assign twice to avoid any 'used once' warnings
+ *{$root."::$var"} = (!$type) ? \&{$pkg."::$var"}
+ : ($type eq '&') ? \&{$pkg."::$var"}
+ : ($type eq '$') ? \${$pkg."::$var"}
+ : ($type eq '@') ? \@{$pkg."::$var"}
+ : ($type eq '%') ? \%{$pkg."::$var"}
+ : ($type eq '*') ? *{$pkg."::$var"}
+ : croak(qq(Can't share "$type$var" of unknown type));
+ }
}
$obj->share_record($pkg, $vars) unless $no_record or !$vars;
}
+
sub share_record {
my $obj = shift;
my $pkg = shift;
@@ -264,41 +308,137 @@ sub share_record {
# Record shares using keys of $obj->{Shares}. See reinit.
@{$shares}{@$vars} = ($pkg) x @$vars if @$vars;
}
+
+
sub share_redo {
my $obj = shift;
my $shares = \%{$obj->{Shares} ||= {}};
my($var, $pkg);
while(($var, $pkg) = each %$shares) {
- # warn "share_redo $pkg\:: $var";
- $obj->share_from($pkg, [ $var ], 1);
+ # warn "share_redo $pkg\:: $var";
+ $obj->share_from($pkg, [ $var ], 1);
}
}
+
+
sub share_forget {
delete shift->{Shares};
}
+
sub varglob {
my ($obj, $var) = @_;
no strict 'refs';
return *{$obj->root()."::$var"};
}
+sub _clean_stash {
+ my ($root, $saved_refs) = @_;
+ $saved_refs ||= [];
+ no strict 'refs';
+ foreach my $hook (qw(DESTROY AUTOLOAD), grep /^\(/, keys %$root) {
+ push @$saved_refs, \*{$root.$hook};
+ delete ${$root}{$hook};
+ }
+
+ for (grep /::$/, keys %$root) {
+ next if \%{$root.$_} eq \%$root;
+ _clean_stash($root.$_, $saved_refs);
+ }
+}
sub reval {
my ($obj, $expr, $strict) = @_;
my $root = $obj->{Root};
- my $evalsub = lexless_anon_sub($root,$strict, $expr);
- return Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
+ my $evalsub = lexless_anon_sub($root, $strict, $expr);
+ # propagate context
+ my $sg = sub_generation();
+ my @subret = (wantarray)
+ ? Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub)
+ : scalar Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
+ _clean_stash($root.'::') if $sg != sub_generation();
+ $obj->wrap_code_refs_within(@subret);
+ return (wantarray) ? @subret : $subret[0];
}
+
+sub wrap_code_refs_within {
+ my $obj = shift;
+
+ $obj->_find_code_refs('wrap_code_ref', @_);
+}
+
+
+sub _find_code_refs {
+ my $obj = shift;
+ my $visitor = shift;
+
+ for my $item (@_) {
+ my $reftype = $item && reftype $item
+ or next;
+ if ($reftype eq 'ARRAY') {
+ $obj->_find_code_refs($visitor, @$item);
+ }
+ elsif ($reftype eq 'HASH') {
+ $obj->_find_code_refs($visitor, values %$item);
+ }
+ # XXX GLOBs?
+ elsif ($reftype eq 'CODE') {
+ $item = $obj->$visitor($item);
+ }
+ }
+}
+
+
+sub wrap_code_ref {
+ my ($obj, $sub) = @_;
+
+ # wrap code ref $sub with _safe_call_sv so that, when called, the
+ # execution will happen with the compartment fully 'in effect'.
+
+ croak "Not a CODE reference"
+ if reftype $sub ne 'CODE';
+
+ my $ret = sub {
+ my @args = @_; # lexical to close over
+ my $sub_with_args = sub { $sub->(@args) };
+
+ my @subret;
+ my $error;
+ do {
+ local $@; # needed due to perl_call_sv(sv, G_EVAL|G_KEEPERR)
+ my $sg = sub_generation();
+ @subret = (wantarray)
+ ? Opcode::_safe_call_sv($obj->{Root}, $obj->{Mask}, $sub_with_args)
+ : scalar Opcode::_safe_call_sv($obj->{Root}, $obj->{Mask}, $sub_with_args);
+ $error = $@;
+ _clean_stash($obj->{Root}.'::') if $sg != sub_generation();
+ };
+ if ($error) { # rethrow exception
+ $error =~ s/\t\(in cleanup\) //; # prefix added by G_KEEPERR
+ die $error;
+ }
+ return (wantarray) ? @subret : $subret[0];
+ };
+
+ return $ret;
+}
+
+
sub rdo {
my ($obj, $file) = @_;
my $root = $obj->{Root};
+ my $sg = sub_generation();
my $evalsub = eval
- sprintf('package %s; sub { @_ = (); do $file }', $root);
- return Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
+ sprintf('package %s; sub { @_ = (); do $file }', $root);
+ my @subret = (wantarray)
+ ? Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub)
+ : scalar Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
+ _clean_stash($root.'::') if $sg != sub_generation();
+ $obj->wrap_code_refs_within(@subret);
+ return (wantarray) ? @subret : $subret[0];
}
@@ -390,15 +530,7 @@ of this software.
Your mileage will vary. If in any doubt B<do not use it>.
-=head2 RECENT CHANGES
-
-The interface to the Safe module has changed quite dramatically since
-version 1 (as supplied with Perl5.002). Study these pages carefully if
-you have code written to use Safe version 1 because you will need to
-makes changes.
-
-
-=head2 Methods in class Safe
+=head1 METHODS
To create a new compartment, use
@@ -417,9 +549,7 @@ object returned by the above constructor
is implicit in each case.
-=over 8
-
-=item permit (OP, ...)
+=head2 permit (OP, ...)
Permit the listed operators to be used when compiling code in the
compartment (in I<addition> to any operators already permitted).
@@ -427,29 +557,30 @@ compartment (in I<addition> to any opera
You can list opcodes by names, or use a tag name; see
L<Opcode/"Predefined Opcode Tags">.
-=item permit_only (OP, ...)
+=head2 permit_only (OP, ...)
Permit I<only> the listed operators to be used when compiling code in
the compartment (I<no> other operators are permitted).
-=item deny (OP, ...)
+=head2 deny (OP, ...)
Deny the listed operators from being used when compiling code in the
compartment (other operators may still be permitted).
-=item deny_only (OP, ...)
+=head2 deny_only (OP, ...)
Deny I<only> the listed operators from being used when compiling code
-in the compartment (I<all> other operators will be permitted).
+in the compartment (I<all> other operators will be permitted, so you probably
+don't want to use this method).
-=item trap (OP, ...)
+=head2 trap (OP, ...)
-=item untrap (OP, ...)
+=head2 untrap (OP, ...)
The trap and untrap methods are synonyms for deny and permit
respectfully.
-=item share (NAME, ...)
+=head2 share (NAME, ...)
This shares the variable(s) in the argument list with the compartment.
This is almost identical to exporting variables using the L<Exporter>
@@ -465,9 +596,9 @@ for a glob (i.e. all symbol table entri
including scalar, array, hash, sub and filehandle).
Each NAME is assumed to be in the calling package. See share_from
-for an alternative method (which share uses).
+for an alternative method (which C<share> uses).
-=item share_from (PACKAGE, ARRAYREF)
+=head2 share_from (PACKAGE, ARRAYREF)
This method is similar to share() but allows you to explicitly name the
package that symbols should be shared from. The symbol names (including
@@ -475,20 +606,29 @@ type characters) are supplied as an arra
$safe->share_from('main', [ '$foo', '%bar', 'func' ]);
+Names can include package names, which are relative to the specified PACKAGE.
+So these two calls have the same effect:
+
+ $safe->share_from('Scalar::Util', [ 'reftype' ]);
+ $safe->share_from('main', [ 'Scalar::Util::reftype' ]);
-=item varglob (VARNAME)
+=head2 varglob (VARNAME)
This returns a glob reference for the symbol table entry of VARNAME in
the package of the compartment. VARNAME must be the B<name> of a
-variable without any leading type marker. For example,
+variable without any leading type marker. For example:
+
+ ${$cpt->varglob('foo')} = "Hello world";
+
+has the same effect as:
$cpt = new Safe 'Root';
$Root::foo = "Hello world";
- # Equivalent version which doesn't need to know $cpt's package name:
- ${$cpt->varglob('foo')} = "Hello world";
+but avoids the need to know $cpt's package name.
-=item reval (STRING, STRICT)
+
+=head2 reval (STRING, STRICT)
This evaluates STRING as perl code inside the compartment.
@@ -511,9 +651,9 @@ expression evaluated, or a return statem
subroutines and B<eval()>. The context (list or scalar) is determined
by the caller as usual.
-This behaviour differs from the beta distribution of the Safe extension
-where earlier versions of perl made it hard to mimic the return
-behaviour of the eval() command and the context was always scalar.
+If the return value of reval() is (or contains) any code reference,
+those code references are wrapped to be themselves executed always
+in the compartment. See L</wrap_code_refs_within>.
The formerly undocumented STRICT argument sets strictness: if true
'use strict;' is used, otherwise it uses 'no strict;'. B<Note>: if
@@ -553,14 +693,12 @@ the code in the compartment.
A similar effect applies to I<all> runtime symbol lookups in code
called from a compartment but not compiled within it.
-
-
-=item rdo (FILENAME)
+=head2 rdo (FILENAME)
This evaluates the contents of file FILENAME inside the compartment.
See above documentation on the B<reval> method for further details.
-=item root (NAMESPACE)
+=head2 root (NAMESPACE)
This method returns the name of the package that is the root of the
compartment's namespace.
@@ -569,7 +707,7 @@ Note that this behaviour differs from ve
where the root module could be used to change the namespace. That
functionality has been withdrawn pending deeper consideration.
-=item mask (MASK)
+=head2 mask (MASK)
This is a get-or-set method for the compartment's operator mask.
@@ -579,14 +717,34 @@ the compartment.
With the MASK argument present, it sets the operator mask for the
compartment (equivalent to calling the deny_only method).
-=back
+=head2 wrap_code_ref (CODEREF)
+Returns a reference to an anonymous subroutine that, when executed, will call
+CODEREF with the Safe compartment 'in effect'. In other words, with the
+package namespace adjusted and the opmask enabled.
-=head2 Some Safety Issues
+Note that the opmask doesn't affect the already compiled code, it only affects
+any I<further> compilation that the already compiled code may try to perform.
-This section is currently just an outline of some of the things code in
-a compartment might do (intentionally or unintentionally) which can
-have an effect outside the compartment.
+This is particularly useful when applied to code references returned from reval().
+
+(It also provides a kind of workaround for RT#60374: "Safe.pm sort {} bug with
+-Dusethreads". See L<http://rt.perl.org/rt3//Public/Bug/Display.html?id=60374>
+for I<much> more detail.)
+
+=head2 wrap_code_refs_within (...)
+
+Wraps any CODE references found within the arguments by replacing each with the
+result of calling L</wrap_code_ref> on the CODE reference. Any ARRAY or HASH
+references in the arguments are inspected recursively.
+
+Returns nothing.
+
+=head1 RISKS
+
+This section is just an outline of some of the things code in a compartment
+might do (intentionally or unintentionally) which can have an effect outside
+the compartment.
=over 8
@@ -624,7 +782,7 @@ but more subtle effect.
=back
-=head2 AUTHOR
+=head1 AUTHOR
Originally designed and implemented by Malcolm Beattie.

View file

@ -1,8 +1,15 @@
$NetBSD: patch-zc,v 1.3 2008/10/10 21:58:44 he Exp $
--- Policy_sh.SH.orig 2007-12-18 11:47:07.000000000 +0100
+++ Policy_sh.SH
@@ -184,10 +184,10 @@ do
--- Policy_sh.SH.orig 2010-04-26 08:08:20.000000000 +0000
+++ Policy_sh.SH 2010-05-27 09:34:44.000000000 +0000
@@ -165,7 +165,7 @@
# We don't know what to do with these yet.
html1dir) dflt='' ;;
- htm31dir) dflt='' ;;
+ html3dir) dflt='' ;;
# Directories for site-specific add-on files
sitebin) dflt=$siteprefix/bin ;;
@@ -184,11 +184,11 @@
;;
sitearch) dflt="$sitelib/$archname" ;;
@ -12,11 +19,13 @@ $NetBSD: patch-zc,v 1.3 2008/10/10 21:58:44 he Exp $
+ siteman3dir) dflt="$siteprefix/man/man3" ;;
# We don't know what to do with these yet.
- sitehtml1) dflt='' ;;
- sitehtm31dir) dflt='' ;;
+ sitehtml1dir) dflt='' ;;
sitehtm31dir) dflt='' ;;
+ sitehtml3dir) dflt='' ;;
# Directories for vendor-supplied add-on files
@@ -213,11 +213,11 @@ do
# These are all usually empty.
@@ -213,11 +213,11 @@
;;
vendorarch) dflt="$vendorlib/$archname" ;;

View file

@ -1,12 +1,11 @@
$NetBSD: patch-zd,v 1.2 2009/12/14 06:36:57 seb Exp $
$NetBSD: patch-zd,v 1.3 2010/08/19 20:47:10 seb Exp $
--- lib/Module/Build/t/tilde.t.orig 2009-12-06 21:07:16.000000000 +0000
+++ lib/Module/Build/t/tilde.t 2009-12-06 21:07:18.000000000 +0000
@@ -44,7 +44,9 @@
$home = VMS::Filespec::unixify($home);
--- cpan/Module-Build/t/tilde.t.orig 2010-05-21 04:15:46.000000000 +0000
+++ cpan/Module-Build/t/tilde.t 2010-05-21 04:16:29.000000000 +0000
@@ -44,6 +44,9 @@
$home =~ s#/$##;
}
-
+ if ($home =~ /work\/.home/) {
+ skip "Skipping test in pkgsrc env to avoid FAKE_HOME trouble", 15;
+ }