|
2019-05-17
| ||
| 10:12 | • Closed ticket [cc74e50996]: open command fails with .ext file extension (only)</... artifact: a4526aef1b user: fvogel | |
|
2019-05-16
| ||
| 07:05 | • Ticket [cc74e50996]: 3 changes artifact: feaa3de727 user: fvogel | |
|
2019-05-14
| ||
| 11:46 | • Ticket [cc74e50996]: 3 changes artifact: 1f5c95b217 user: sebres | |
| 11:39 | • Ticket [cc74e50996]: 3 changes artifact: 9134fd97f0 user: sebres | |
|
2019-05-13
| ||
| 09:21 | • Ticket [cc74e50996]: 3 changes artifact: 2bbeb0117e user: fvogel | |
| 08:48 | • Ticket [cc74e50996]: 3 changes artifact: df68c0ad6a user: sebres | |
|
2019-05-12
| ||
| 17:33 | • Ticket [cc74e50996]: 4 changes artifact: 83313ea789 user: fvogel | |
|
2019-04-13
| ||
| 09:56 | • New ticket [cc74e50996]. artifact: 09eba16d0c user: fvogel | |
open command fails with .ext file extension (only)
open "E:/tcltk-fossil/tcltk/5 7 8.ext" w ; # fails: permission denied
Changing the file extension to .txt, or .exe, or .zer, or whatever, or removing the extension from the filename, let this command work. It seems to fail with ".ext" file extension only.
This happens on a Windows 10 machine running Tcl as a normal unpriviledged user, however I can read and write files on disk E:\
It does not happen on a Vista machine on which I'm an admin (that said, directory is different).
Investigation in the source code shows that the call (tclWinChan.c: 951):
handle = CreateFile(nativeName, accessMode, shareMode,
NULL, createMode, flags, (HANDLE) NULL);
returns INVALID_HANDLE_VALUE, indicating failure of file creation.
Arguments of this call are:
nativeName = 0x00b6ccd8 "E:\tcltk-fossil\tcltk\5 7 8.ext" accessMode = 1073741824 shareMode = 3 createMode = 2 flags = 128
When running:
open "E:/tcltk-fossil/tcltk/5 7 8.txt" wthen the same call succeeds (with the same arguments, except the filename which now has .txt extension instead of .ext).
So the open command may fail just because a filename has .ext extension? That's weird...
For the records, I have run into this while investigating Tk test suite failures on that Win10 machine, that do not happen on a Vista machine. For the record, ""E:\tcltk-fossil\tcltk" is the directory returned on that Win10 machine by proc initialdir in winDialog.test, which just returns tcltest::temporaryDirectory.
These failures reported by the Tk test suite are:
==== winDialog-5.7.6 GetFileName: All/extension FAILED
==== Contents of test case:
# In 8.6.4 this combination resulted in bar.ext.ext which is bad
start {set x [tk_getSaveFile -filetypes {{All *}} -defaultextension {ext} -title Save]}
set msg {}
then {
if {[catch {SetText [vista? 0x47C 0x3e9] bar} msg]} {
Click cancel
} else {
Click ok
}
}
set x "[file tail $x]$msg"
---- Result was:
---- Result should have been (exact matching):
bar.ext
==== winDialog-5.7.6 FAILED
==== winDialog-5.7.7 tk_getOpenFile: -defaultextension FAILED
==== Contents of test case:
unset -nocomplain x
tcltest::makeFile "" "5 7 7.ext" [initialdir]
start {set x [tk_getOpenFile -defaultextension ext -initialdir [file nativename [initialdir]] -initialfile "5 7 7" -title Foo]}
then {
Click ok
}
return $x
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't open "E:/tcltk-fossil/tk/win/5 7 7.ext": permission denied
while executing
"open $fullName w"
(procedure "tcltest::makeFile" line 13)
invoked from within
"tcltest::makeFile "" "5 7 7.ext" [initialdir]"
("uplevel" body line 3)
invoked from within
"uplevel 1 $script"
---- errorCode: POSIX EACCES {permission denied}
==== winDialog-5.7.7 FAILED
initialdir= E:/tcltk-fossil/tk/win
==== winDialog-5.7.8 tk_getOpenFile: -defaultextension FAILED
==== Contents of test case:
unset -nocomplain x
puts "initialdir= [initialdir]"
tcltest::makeFile "" "5 7 8.ext" [initialdir]
tk_messageBox
start {set x [tk_getOpenFile -defaultextension ext -initialdir [file nativename [initialdir]] -initialfile "5 7 8.ext" -title Foo]}
then {
Click ok
}
return $x
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't open "E:/tcltk-fossil/tk/win/5 7 8.ext": permission denied
while executing
"open $fullName w"
(procedure "tcltest::makeFile" line 13)
invoked from within
"tcltest::makeFile "" "5 7 8.ext" [initialdir]"
("uplevel" body line 4)
invoked from within
"uplevel 1 $script"
---- errorCode: POSIX EACCES {permission denied}
==== winDialog-5.7.8 FAILED
> This happens on a Windows 10 machine running Tcl as a normal unpriviledged user, however I can read and write files on disk E:\
Have you tried to create this file from file explorer, François? I mean like enter "E:\tcltk-fossil\tcltk", right click -> new file -> "5 7 8.ext".
Because I don't have any issue doing close [open "./5 7 8.ext" w] with latest 8.6 branch on my test Win10-VM (with all current updates).
Maybe a rude Antivirus could cause this?
Thanks for your answer. Yes I can create the file with the explorer, no problem.
Hmmm... the create via file explorer seems to be not really a create - it would create a "New Dokument.txt" and then entering rename "dialog".
So it is not really the same... quasi comparable then with
clock [open ${fn}.txt wb]; file rename ${fn}.txt ${fn}.ext
Anyway, I tried it also at home on PC of my children. Not reproduceable (I can create it without any error).
Did you try to disable Antivirus (or Real Protection)?
Maybe you could try a create with something else, like `touch` from mingw or from other langs (like perl or python):
python -c "open('./5 7 8.ext', 'a').close()"
I can reproduce under python:
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
>>> open('E:/tcltk-fossil/tcltk/5 7 8.ext', 'a').close()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
PermissionError: [Errno 13] Permission denied: 'E:/tcltk-fossil/tcltk/5 7 8.ext'
>>>
Replacing the .ext extension by .txt makes the problem vanish.
So it's the same in Tcl and in Python.
I have analyzed thus deeper and have found that this problem is due to a third party software "protecting" the computer. Disabling this software product makes the probkem diappear. Tcl has no responsibility here. Closing as Invalid.