[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2009-07-07 Thread Peter Simanyi
Peter Simanyi added the comment: I verified that launching the script from a CMD.EXE window instead of from Cygwin also reproduces the "can't overwrite ZZZ.pyc". Here's a sample of "python -v" showing this: # C:\depot\central\ntf\tools\bin\build1.pyc has bad

[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2009-05-27 Thread Peter Simanyi
Peter Simanyi added the comment: Re: chmod 0666 inappropriate: I agree that leaving a file 0666 is inappropriate, however theoretically the code should never leave the file 0666 since the unlink will delete the file. The code was intended to show what the problem is by demonstrating a

[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2009-05-26 Thread Peter Simanyi
Peter Simanyi added the comment: I realized that my patch, with a chmod(..., 0600), may not work under certain conditions where the original file is owned by a different user but the directory is group- or world-writable. A more likely correct fix would use chmod(..., 0666). At any rate

[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2009-05-26 Thread Peter Simanyi
Peter Simanyi added the comment: I have a fix for this. The code is Windows-only. It has been verified to work for attached test script showpycreadonlysleep.sh. It simply adds a "chmod" call. The issue is that the unlink() call silently fails if the file is readonly, but unlink(

[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2009-05-26 Thread Peter Simanyi
Peter Simanyi added the comment: I may have a reason to analyze that would explain why this fails on Windows: the non-Windows code path in import.c's open_exclusive() contians an unlink(filename), but the Windows path does not. I'm going to try to build Python on Windows and add

[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2009-05-26 Thread Peter Simanyi
Peter Simanyi added the comment: Re: Ubuntu: I can't reproduce the problem. At this point, I consider this problem Windows XP-only. Re: Windows & bash: I decided to verify that this problem occurs even if running outside of Bash in the native (and wonderful) shell CMD.EXE. It *do

[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2009-05-26 Thread Peter Simanyi
Peter Simanyi added the comment: Oops, I was not accurate in reporting behavior: I now believe that this fails on Windows XP, but may work fine on Linux. Below are my results, showing reproducible failure on XP. The most important thing about this is: on XP, once the .pyc file is "b

[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2009-05-20 Thread Peter Simanyi
New submission from Peter Simanyi : Some source code control tools, like Perforce, by default sync files readonly, and it's useful to leave them readonly so that you can mark files changed by making them writeable even if they're not checked out (e.g. working offline). W