Overview
| Artifact ID: | f082a97fbe6a2918a4e296ce84592146fdb0dc1b358a682c2a8feae826174a05 |
|---|---|
| Ticket: | 7de2d722bd599da5db26b42ed8addb16a66c832c
cmdAH-25.2 (Tcl_FileObjCmd: owned) fails on Windows |
| User & Date: | fvogel on 2019-09-10 22:12:36 |
Changes
- icomment:
<i>> If I debug the test (output a file name), I see the file is pretty well created in my %TEMP% directory so as C:/Temp/gorp.file</i> For me the file is <code>C:/Users/francois/AppData/Local/Temp/gorp.file</code> and <code>echo %TEMP%</code> returns <code>C:\Users\francois\AppData\Local\Temp</code>. So yes for me too the file is pretty well created in my %TEMP% directory. A difference is that %TEMP% is located in my Windows profile (does this really make a difference?). <i>> Do you see 1 if you execute both of this in tclsh? <verbatim> > close [open [set fn $::env(TEMP)/test-owner-from-tcl.txt] w]; puts [file owned $fn]; file delete $fn > > set fn $::env(TEMP)/test-owner-from-tcl/1.txt; file mkdir [file dirname $fn]; > close [open $fn w]; puts [file owned $fn]; file delete -force [file dirname $fn] </verbatim> </i> Actually no, I see two zeroes. <i>> Can you try to change the owner using takeown if above mentioned script fails for you. But somehow I'm pretty sure exec takeown /F [file nativename $fn] would fail for you. </i> Nope, it works. I'm seeing 0 and 1 when executing the following: <verbatim> close [open [set fn $::env(TEMP)/test-owner-from-tcl.txt] w]; puts [file owned $fn] exec takeown /F [file nativename $fn]; puts [file owned $fn] </verbatim> This is on a Vista computer on which I'm logged in and using from an account 'francois' having administrator privileges. Before running <code>takeown</code>, the owner of the file is mycomputername\Administrators, but after taking ownership it becomes mycomputername\francois. User 'francois' has admin privileges. I didnt yet check on another computer, running Win 10, on which I'm logged in as an ordinary user. I'm seeing the problem described in the present ticket on both computers. <i>> Also note that in Windows (since 8.6) we check ownership using TclWinFileOwned, which can return 0 in case of GetNamedSecurityInfo, OpenProcessToken or GetTokenInformation fail</i> I have already confirmed that TclWinFileOwned returns false not because of the above but really because <code>EqualSid()</> returns zero (see my first comment below dated 2019-09-08 10:38:11, first line). Given the switch made by <code>takeown</code> and the change of result for 'file owner', this is all consistent.
- login: "fvogel"
- mimetype: "text/x-fossil-wiki"