diff options
author | Andy Armstrong <andy@hexten.net> | 2010-08-15 12:05:23 +0100 |
---|---|---|
committer | George Greer <perl@greerga.m-l.org> | 2010-08-17 18:36:31 -0400 |
commit | c410dd6ad7a0e7169d54bd81c10eae997ada5d38 (patch) | |
tree | bbc1248b42740261aae1933117cd40cfb339562d | |
parent | 4feb80ac47a22e7de7d7c1c1d5dfb3d744a2a3a7 (diff) | |
download | perl-c410dd6ad7a0e7169d54bd81c10eae997ada5d38.tar.gz |
Make sure the stack is balanced in the case that we fake the result of unsupported filetests.
This time with an appropriate comment on the test. And with that I'll
attempt to stop spamming P5P, at least for today, and go and do
something less risky. Running with scissors perhaps.
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | pp_sys.c | 12 | ||||
-rw-r--r-- | t/op/filetest_stack_ok.t | 19 |
3 files changed, 29 insertions, 3 deletions
@@ -4483,6 +4483,7 @@ t/op/exp.t See if math functions work t/op/fh.t See if filehandles work t/op/filehandle.t Tests for http://rt.perl.org/rt3/Ticket/Display.html?id=72586 t/op/filetest.t See if file tests work +t/op/filetest_stack_ok.t See if file tests leave their argument on the stack t/op/filetest_t.t See if -t file test works t/op/flip.t See if range operator works t/op/fork.t See if fork works @@ -3219,16 +3219,22 @@ PP(pp_ftrowned) /* I believe that all these three are likely to be defined on most every system these days. */ #ifndef S_ISUID - if(PL_op->op_type == OP_FTSUID) + if(PL_op->op_type == OP_FTSUID) { + (void) POPs; RETPUSHNO; + } #endif #ifndef S_ISGID - if(PL_op->op_type == OP_FTSGID) + if(PL_op->op_type == OP_FTSGID) { + (void) POPs; RETPUSHNO; + } #endif #ifndef S_ISVTX - if(PL_op->op_type == OP_FTSVTX) + if(PL_op->op_type == OP_FTSVTX) { + (void) POPs; RETPUSHNO; + } #endif STACKED_FTEST_CHECK; diff --git a/t/op/filetest_stack_ok.t b/t/op/filetest_stack_ok.t new file mode 100644 index 0000000000..91e31e0a27 --- /dev/null +++ b/t/op/filetest_stack_ok.t @@ -0,0 +1,19 @@ +#!./perl + +# On platforms that don't support all of the filetest operators the code +# that faked the results of missing tests used to leave the test's +# argument on the stack. + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + require './test.pl'; +} + +my @ops = split //, 'rwxoRWXOezsfdlpSbctugkTMBAC'; + +plan( tests => @ops * 1 ); + +for my $op (@ops) { + ok( 1 == @{ [ eval "-$op 'TEST'" ] }, "-$op returns single value" ); +} |