summaryrefslogtreecommitdiff
path: root/t/op/filetest.t
diff options
context:
space:
mode:
authorGerben Wierda <G.C.Th.Wierda@AWT.nl>1998-11-20 20:39:06 +0200
committerJarkko Hietaniemi <jhi@iki.fi>1998-11-22 11:42:59 +0000
commit846f25a3508eb6a488aff23d772d9cd4768661b5 (patch)
tree2cdff9ddbbe20532f7a07d99391701c5cb2c877f /t/op/filetest.t
parent468541a8c6a923aaa6f4473c12876600d43e57de (diff)
downloadperl-846f25a3508eb6a488aff23d772d9cd4768661b5.tar.gz
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: <MLIST_9811201533.AA22148@AWT.nl> p4raw-id: //depot/cfgperl@2263
Diffstat (limited to 't/op/filetest.t')
-rw-r--r--t/op/filetest.t21
1 files changed, 16 insertions, 5 deletions
diff --git a/t/op/filetest.t b/t/op/filetest.t
index 13c5917adc..9228b5730b 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";