Artifacts Associated With Ticket 1622579
Ticket change [4483e22737] (rid 116726) by fvogelnew1 on 2006-12-26 20:53:00:
- assignee initialized to: "andreas_kupries"
- cmimetype initialized to: "text/plain"
- comment initialized to:
On Windows XP, create any file and give it the readonly attribute through the properties dialog. Then, try to open this file for writing: open "bizarre1_hidden.log2": w Tcl complains: couldn't open "bizarre1_hidden.log2": permission denied I can see no reason for that. Especially, the file is writable: % file writable bizarre1_hidden.log2 1 Francois
- foundin initialized to: "obsolete: 8.4.14"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "fvogelnew1"
- subsystem initialized to: "25. Channel System"
- title initialized to: "open fails to open hidden files for writing"
- type initialized to: "Bug"
Ticket change [e9547fed5d] (rid 104803) by patthoyts on 2007-01-03 20:40:45:
- closedate changed to: "2007-01-03T13:40:45"
- closer changed to: "patthoyts"
- icomment:
Logged In: YES user_id=202636 Originator: NO "give it the readonly attribute" You mean hidden. The issue here is that the file exists already with non-default attributes. Mode 'w' means WRONLY|CREAT|TRUNC which is translated into OPEN_ALWAYS and as we look like we are creating the file we expect to set the attributes to FILE_ATTRIBUTE_NORMAL. As the file exists but has FILE_ATTRIBUTE_HIDDEN we get a permission denied from windows. The solution is to open with appropriate flags: % set f [open z.txt w]; puts $f test; close $f % file attributes z.txt -hidden 1 % % list [set f [open z.txt w]] [close $f] couldn't open "z.txt": permission denied % list [set f [open z.txt a]] [close $f] filea260e8 {} % list [set f [open z.txt a+]] [close $f] filea21648 {} % list [set f [open z.txt "WRONLY CREAT"]] [close $f] filea26150 % list [set f [open z.txt "WRONLY CREAT TRUNC"]] [close $f] couldn't open "z.txt": permission denied I don't think this is a bug myself. - login: "patthoyts"
- mimetype: "text/plain"
- resolution changed to: "Wont Fix"
- status changed to: "Pending"
- username: "patthoyts"
Ticket change [e16ca1b875] (rid 87444) by fvogelnew1 on 2007-01-04 03:38:29:
- icomment:
Logged In: YES user_id=1245417 Originator: YES I understand your answer and I thank you very much for your so clear explanations. What I need is a mode that will let me write my file in any case, i.e. to overwrite if the file exists (no append), or to create the file if it does not yet exist. And this, whether the file is hidden or not. From the "open" man page, I had understood that "WRONLY CREAT TRUNC" was what I needed, and translated this simply into "w". I now understand that I should use "WRONLY CREAT", right? But for TRUNC I can read: "If the file exists it is truncated to zero length." But this seems to be what I need! Because otherwise I would append, or am I missing something? Anyway, it seems from my tests that I actually don't need the TRUNC parameter. Question is "why?" Thanks, Francois
- login: "fvogelnew1"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "fvogelnew1"
- icomment:
Ticket change [d7678bb845] (rid 123982) by dkf on 2007-01-04 05:51:46:
- closedate changed to: "2007-01-03T22:51:46"
- closer changed to: "dkf"
- status changed to: "Closed"
Ticket change [e5e49d70cc] (rid 136974) by andreask on 2014-02-19 20:32:33:
- submitter changed to: "fvogel"