develooper Front page | perl.perl5.porters | Postings from March 2000

[ID 20000308.006] use in Safe compartments

Matt Sergeant
March 8, 2000 11:04
[ID 20000308.006] use in Safe compartments
Message ID:

This is a bug report for perl from,
generated with the help of perlbug 1.26 running under perl 5.00503.

[Please enter your report here]


use Safe;
my $c = Safe->new;
$c->permit(qw/:browse require/);
$c->reval('use English; print $PID;');
die $@ if $@
Undefined subroutine &Exporter::import called at /usr/lib/perl5/5.00503/ line 47.
BEGIN failed--compilation aborted at (eval 2) line 1.

The problem is that 'use' in a safe compartment doesn't remove the
barrier that safe compartments can't look in other packages, so

use Exporter;

doesn't allow you to call &Exporter::import like you can outside
of a safe compartment.

My theory is that we need a sort of peephole, so that if you allow the
require permit, and you use() a module, you should get a peephole into
that package's namespace.

(The motivation for this is a Safe compartment for mod_perl - without
this functionality it's useless).

[Please do not change anything below this line]

This perlbug was built using Perl 5.00503 - Tue Apr 13 04:04:31 CEST 1999
It is being executed now by  Perl 5.00557 - Fri Jul 16 22:00:43 /etc/localtime 1999.

Site configuration information for perl 5.00503:

Configured by root at Tue Apr 13 04:04:31 CEST 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
    osname=linux, osvers=2.2.5-4, archname=i386-linux
    uname='linux vador 2.2.5-4 #1 tue apr 6 19:46:00 edt 1999 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
    cc='cc', optimize='-O2', gccversion=pgcc-2.91.60 19981201 (egcs-1.1.1 release)
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:

@INC for perl 5.00503:

Environment for perl 5.00503:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    SHELL=/bin/bash Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About