From: Rafael Garcia-Suarez Date: Thu, 3 Oct 2002 20:34:13 +0000 (+0000) Subject: Change the warning message "%s trapped by operation mask" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cb77fdf0e62f488063efd544deea3e13e215fac6;p=p5sagit%2Fp5-mst-13.2.git Change the warning message "%s trapped by operation mask" to include '' around the op name. Document it in perldiag. p4raw-id: //depot/perl@17973 --- diff --git a/ext/Opcode/Opcode.t b/ext/Opcode/Opcode.t index a785fce..9f2748c 100755 --- a/ext/Opcode/Opcode.t +++ b/ext/Opcode/Opcode.t @@ -87,7 +87,7 @@ print verify_opset($s1) && !verify_opset(42) ? "ok $t\n":"not ok $t\n"; $t++; opmask_add(opset(qw(fileno))); # add to global op_mask print eval 'fileno STDOUT' ? "not ok $t\n" : "ok $t\n"; $t++; # fail -print $@ =~ /fileno trapped/ ? "ok $t\n" : "not ok $t\n# $@\n"; $t++; +print $@ =~ /'fileno' trapped/ ? "ok $t\n" : "not ok $t\n# $@\n"; $t++; # --- check use of bit vector ops on opsets diff --git a/ext/Opcode/Safe.pm b/ext/Opcode/Safe.pm index b041ef7..e8efaa9 100644 --- a/ext/Opcode/Safe.pm +++ b/ext/Opcode/Safe.pm @@ -427,7 +427,7 @@ C package to the code inside the compartment. Any attempt by the code in STRING to use an operator which is not permitted by the compartment will cause an error (at run-time of the main program but at compile-time for the code in STRING). The error is of the form -"%s trapped by operation mask operation...". +"'%s' trapped by operation mask...". If an operation is trapped in this way, then the code in STRING will not be executed. If such a trapped operation occurs or any other diff --git a/ext/Safe/safe2.t b/ext/Safe/safe2.t index d967b19..94398d4 100755 --- a/ext/Safe/safe2.t +++ b/ext/Safe/safe2.t @@ -38,7 +38,7 @@ $cpt = new Safe or die; $cpt = new Safe "Root"; $cpt->reval(q{ system("echo not ok 1"); }); -if ($@ =~ /^system trapped by operation mask/) { +if ($@ =~ /^'system' trapped by operation mask/) { print "ok 1\n"; } else { print "#$@" if $@; diff --git a/op.c b/op.c index 85c0740..c589fce 100644 --- a/op.c +++ b/op.c @@ -104,7 +104,7 @@ S_Slab_Free(pTHX_ void *op) #define CHECKOP(type,o) \ ((PL_op_mask && PL_op_mask[type]) \ ? ( op_free((OP*)o), \ - Perl_croak(aTHX_ "%s trapped by operation mask", PL_op_desc[type]), \ + Perl_croak(aTHX_ "'%s' trapped by operation mask", PL_op_desc[type]), \ Nullop ) \ : CALL_FPTR(PL_check[type])(aTHX_ (OP*)o)) diff --git a/pod/perldiag.pod b/pod/perldiag.pod index f174a91..8f7d0ec 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -165,6 +165,11 @@ or a hash or array slice, such as: name, and not a subroutine call. C will generate this error. +=item '%s' trapped by operation mask + +(F) You tried to use an operator from a Safe compartment in which it's +disallowed. See L. + =item Argument "%s" isn't numeric%s (W numeric) The indicated string was fed as an argument to an operator