From 846f25a3508eb6a488aff23d772d9cd4768661b5 Mon Sep 17 00:00:00 2001 From: Gerben Wierda Date: Fri, 20 Nov 1998 20:39:06 +0200 Subject: [PATCH] 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 --- t/op/filetest.t | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) 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"; -- 1.8.3.1