summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2019-09-11 11:49:59 (GMT)
committersebres <sebres@users.sourceforge.net>2019-09-11 11:49:59 (GMT)
commit56f6e73e6f3bb4c7cf408f25e72f4818914dada3 (patch)
tree3b1cc4ff88ec0f7d4fc4ed5e6d8c46d3fe7eb90c /tests
parent15b4eecc823345b12fb41a87076c06a93fffdebd (diff)
downloadtcl-56f6e73e6f3bb4c7cf408f25e72f4818914dada3.zip
tcl-56f6e73e6f3bb4c7cf408f25e72f4818914dada3.tar.gz
tcl-56f6e73e6f3bb4c7cf408f25e72f4818914dada3.tar.bz2
windows, close [7de2d722bd]: prefer temp file to check owner and reown it before trying to check in order to avoid dependency on admin with UAC and the setting of "System objects: Default owner for objects created by members of the Administrators group"
Diffstat (limited to 'tests')
-rw-r--r--tests/cmdAH.test24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/cmdAH.test b/tests/cmdAH.test
index 03ec3df..563a09e 100644
--- a/tests/cmdAH.test
+++ b/tests/cmdAH.test
@@ -1303,8 +1303,28 @@ test cmdAH-24.20.2 {Tcl_FileObjCmd: mtime 64-bit time_t, bug [4718b41c56]} -cons
test cmdAH-25.1 {Tcl_FileObjCmd: owned} {
list [catch {file owned a b} msg] $msg
} {1 {wrong # args: should be "file owned name"}}
-test cmdAH-25.2 {Tcl_FileObjCmd: owned} -constraints win -body {
- file owned $gorpfile
+test cmdAH-25.2 {Tcl_FileObjCmd: owned} -constraints win -setup {
+ set fn $gorpfile
+ # prefer temp file to check owner (try to avoid bug [7de2d722bd]):
+ if {
+ [info exists ::env(TEMP)] && [file isdirectory $::env(TEMP)] &&
+ [file dirname $fn] ne [file normalize $::env(TEMP)]
+ } {
+ set fn [file join $::env(TEMP)/test-owner-from-tcl.txt]
+ set fn [makeFile "data" test-owner-from-tcl.txt $::env(TEMP)]
+ }
+ # be sure we have really owned this file before trying to check that
+ # (avoid dependency on admin with UAC and the setting "System objects:
+ # Default owner for objects created by members of the Administrators group"):
+ catch {
+ exec takeown /F [file nativename $fn]
+ }
+} -body {
+ file owned $fn
+} -cleanup {
+ if {$fn ne $gorpfile} {
+ removeFile $fn
+ }
} -result 1
test cmdAH-25.2.1 {Tcl_FileObjCmd: owned} -constraints unix -setup {
# Avoid problems with AFS