Prof Brian Ripley wrote: > This was not really accurate. > > Being `read-only' is a Windows phenomenon on open files (even files open > for reading). In 2.0.1 and 2.1.1 the file was open whilst it was parsed > and so `read-only' during that time. In 2.0.1 it was then closed, but in > 2.1.1 it was (potentially) opened several times to find an encoding, > parsed and left open until source() terminated. In 2.2.0 it will be > closed once it has been parsed.
But R doesn't open files in an exclusive mode. It opens them in "share deny none" mode (_SH_DENYNO; this is an undocumented feature of the MSVC run-time library that MinGW uses). I suspect whatever editor Hjellvik was using attempted to open the file with exclusive access, and when that failed (because R had it open), it fell back to read-only access. It's certainly possible to open a file for write access in another process while R has it open for read access. You just can't get exclusive access to it. Duncan Murdoch > > Changing a file after it has been parsed will have no effect, so there is > no reason to prevent it (beyond that was the simplest way to implement > choosing a suitable encoding). > > On Thu, 1 Sep 2005, Hjellvik Vidar wrote: > > >>The OS is Windows XP. >>I use to work on the file while it's executed and save changes >>continually. It doesn't seem to have any effect on the current >>execution. I just find it annoying not to be able to do it. It's not >>crucial, but if there is some easy way around it I would like to >>know.... >> >>-----Original Message----- >>From: Uwe Ligges [mailto:[EMAIL PROTECTED] >>Sent: 1. september 2005 14:21 >>To: Hjellvik Vidar >>Cc: [email protected] >>Subject: Re: [R] source(file) => file becomes readonly >> >> >>Hjellvik Vidar wrote: >> >> >>>Hello, >>>when I work in R, I write code in a text file that I run with the >>>"source(filename)" command. In R2.1.1 the file is read-only while the source >>>command is executed. This was not the case in R2.0.1. Is this a bug-fix or >>>is it possible not to have the file read-only when executed? >> >>So you want to modify a file *while* it is executed? >>Sounds dangerous to me, you may want to explain further... >> >>BTW: Which OS are we talking about? >> >>Uwe Ligges >> >> >> >>>Best regards >>>Vidar >>> >>>______________________________________________ >>>[email protected] mailing list >>>https://stat.ethz.ch/mailman/listinfo/r-help >>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >> >>______________________________________________ >>[email protected] mailing list >>https://stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >> > > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
