From: Gerben Wierda Date: Fri, 20 Nov 1998 18:39:06 +0000 (+0200) Subject: Permission testing is tricky when we have too much power. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=846f25a3508eb6a488aff23d772d9cd4768661b5;p=p5sagit%2Fp5-mst-13.2.git Permission testing is tricky when we have too much power. Problem reported in Subject: Test results for perl5.005_53 under NEXTSTEP 3.3 (intel) To: perlbug@perl.com Message-ID: p4raw-id: //depot/cfgperl@2263 --- diff --git a/t/op/filetest.t b/t/op/filetest.t index 13c5917..9228b57 100644 --- a/t/op/filetest.t +++ b/t/op/filetest.t @@ -26,19 +26,30 @@ print "ok 5\n"; # make sure TEST is r-x eval { chmod 0555, 'TEST' }; -if ($@) { - print "#[$@]\nok 6 # skipped\n"; +$bad_chmod = $@; + +$oldeuid = $>; # root can read and write anything +eval '$> = 1'; # so switch uid (may not be implemented) + +print "# oldeuid = $oldeuid, euid = $>\n"; + +if ($bad_chmod) { + print "#[$@]\nok 6 #skipped\n"; } else { - print "not " if -w 'TEST'; - print "ok 6\n"; + print "not " if -w 'TEST'; + print "ok 6\n"; } -# Scripts are not -x everywhere. +# Scripts are not -x everywhere so cannot test that. print "not " unless -r 'op'; print "ok 7\n"; +eval '$> = $oldeuid'; # switch uid back (may not be implemented) + +# this would fail for the euid 1 +# (unless we have unpacked the source code as uid 1...) print "not " unless -w 'op'; print "ok 8\n";