Tim Golden added the comment:
This has been covered off by work done with the test.support package including
context managers for temporary files / directories, and a waitfor mechanism
which waits some time if a file can't be accessed.
--
resolution: - works for me
status: open -
R. David Murray added the comment:
The support package is fixed (I presume :), but there was also a desire
expressed to expose this functionality in shutil, since it can arise in
normal Python programs as well as in the test suite. Given that the fix has
been successful in the test suite,
Changes by Chris Jerdonek chris.jerdo...@gmail.com:
--
nosy: +cjerdonek
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
___
___
Nick Coghlan added the comment:
See #15496 for an alternative approach to solving this problem, at least in the
test suite - as noted in that issue, the rename dance isn't sufficient when the
problem gets triggered by a different sequence like:
unlink(file_in_parent_dir)
unlink(parent_dir) #
Changes by Nadeem Vawda nadeem.va...@gmail.com:
--
nosy: +nadeem.vawda
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
___
___
Python-bugs-list
Andrew Svetlov andrew.svet...@gmail.com added the comment:
FYI: implementation of unlink already has multiple calls for unicode version to
process symlinks. Ansi version is the simple DeleteFileA call.
Now we have different behavior for unicode and ansi variants as I can see.
Now I'm working
Jeff Dean chima...@gmail.com added the comment:
* Patch Py_DeleteFileW in posixmodule.c so that it renames before
deleting: should solve the problem overall but obviously has a
possible wider impact, in general and on performance in particular.
This rename might be a simple rename-to-guid or
Nick Coghlan ncogh...@gmail.com added the comment:
I'll throw in my 2 cents as to a possible way forward:
- fix test.support.unlink in all current maintenance branches (2.7, 3.1, 3.2,
default)
- expose the feature to users as shutil.rmfile for 3.3
--
Antoine Pitrou pit...@free.fr added the comment:
* Patch Py_DeleteFileW in posixmodule.c so that it renames before
deleting: should solve the problem overall but obviously has a
possible wider impact, in general and on performance in particular.
This rename might be a simple rename-to-guid
Antoine Pitrou pit...@free.fr added the comment:
FWIW, Mercurial uses the following dance:
http://selenic.com/repo/hg/file/463aca32a937/mercurial/windows.py#l296
(Mercurial is under the GPL, so we can't copy that code verbatim; but it can
serve as an inspiration)
--
nosy: +pitrou
Tim Golden m...@timgolden.me.uk added the comment:
For clarity, while making unlink more robust is no bad thing, the error occurs
when the unlink *succeeds* but a subsequent create of the same name fails. This
happens when an indexer, Virus scanner or TortoiseSvn etc. has opened the file
with
Antoine Pitrou pit...@free.fr added the comment:
I did start to undertake a conversion of TESTFN to a named temporary,
but it started to sprawl all over the place and came up against a
number of corner cases (eg where tests deliberately wanted two
filenames to be the same) so I gave up.
How
Tim Golden m...@timgolden.me.uk added the comment:
Well http://bugs.python.org/issue7443#msg102833 outlines the problems I
encountered while trying to do essentially that. Nothing insurmountable, but
definitely bigger than simply adding one line of code.
Looks to me like there are two avenues
Andrew Svetlov andrew.svet...@gmail.com added the comment:
As I can see cygwin's unlink_nt uses Nt* functions family (NtSetInformationFile
etc) which are part of Windows DDK.
Do you like to use them or prefer SDK ones (say SetFileInformationByHandle)?
In second case python unlink can borrow
Changes by Andrew Svetlov andrew.svet...@gmail.com:
--
versions: +Python 3.3 -Python 2.7, Python 3.2
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
___
Nick Coghlan ncogh...@gmail.com added the comment:
I closed issue 9627 as a duplicate of this - the buildbot failure referenced
there was most likely due to something else holding open a temporary file that
the test suite thought was closed.
--
nosy: +ncoghlan
Changes by Tim Golden m...@timgolden.me.uk:
--
assignee: - tim.golden
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
___
___
Python-bugs-list
Tim Golden m...@timgolden.me.uk added the comment:
I put together a trivial patch against the 2.7 trunk (basically: I added
a os.rename before the os.remove in test_support.unlink) and reran my
test harness with test_zipfile... and it still failed because, of course,
test_zipfile calls
Jason R. Coombs jar...@jaraco.com added the comment:
When I was working on a routine to checkout/patch/build/test/cleanup Python
(see https://svn.jaraco.com/jaraco/python/jaraco.develop, and particularly
scripts/test-windows-symlink-patch.py), I ran into a similar problem during the
cleanup
Martin v. Löwis mar...@v.loewis.de added the comment:
1. I agree that we should fix the unlinking problem on Windows. I also think
that such a fix should be independent of the test suite - many people run into
failed unlink problems.
2. Tim already said it, but I repeat: the common theory is
Tim Golden m...@timgolden.me.uk added the comment:
I'm afraid that the problem doesn't lie in the unlink: DeleteFile
succeeds. The problem is that the file is only marked for delete
until such time as the last SHARE_DELETE handle on it is closed.
Until that time, an attempt to (re)create the
Martin v. Löwis mar...@v.loewis.de added the comment:
I'm afraid that the problem doesn't lie in the unlink: DeleteFile
succeeds. The problem is that the file is only marked for delete
until such time as the last SHARE_DELETE handle on it is closed.
Then we shouldn't use DeleteFile in the
Tim Golden m...@timgolden.me.uk added the comment:
Then we shouldn't use DeleteFile in the first place to delete the file,
but instead CreateFile, with DELETE access (and FILE_SHARE_DELETE
sharing). If that fails, we need to move the file to the bin
(see unlink_nt for details).
I see what
Martin v. Löwis mar...@v.loewis.de added the comment:
Would you agree that py3k is the only target branch worth aiming for?
Most certainly, yes.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
Tim Golden m...@timgolden.me.uk added the comment:
This is basically a rerun of this discussion a couple of years ago:
http://mail.python.org/pipermail/python-dev/2008-April/078333.html
The problem certainly still happens against trunk -- I have a semi-aggressive
test-harness which can
anatoly techtonik techto...@gmail.com added the comment:
It is unlikely that it will go further then discussion unless this bug can be
reliably reproduced to be debugged. If not testcase when at least Process
Monitor log would be helpful.
--
___
Tim Golden m...@timgolden.me.uk added the comment:
In one window run the attached script (assumes you have pywin32 installed) with
a parameter of the directory the TESTFN file will end up in. Then run, eg,
test_zipfile in another window. For me:
c:\temp watch_dir.py
R. David Murray rdmur...@bitdance.com added the comment:
If the problem with the fix is that lots of tests use test_support.unlink, then
I don't see why the rename dance can't be implemented in test_support.unlink.
(Possibly conditioned on whether or not the tests are running on a windows
Changes by Jason R. Coombs jar...@jaraco.com:
--
nosy: +jaraco
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
___
___
Python-bugs-list mailing
Andrew Svetlov andrew.svet...@gmail.com added the comment:
Florent, sorry.
I have no Windows workstation now, so I cannot follow this issue.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
anatoly techtonik techto...@gmail.com added the comment:
It would be nice to see standalone test case that illustrates the problem.
--
nosy: +techtonik
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
Sean Reifschneider j...@tummy.com added the comment:
Andrew: There have been changes committed within the last week to #7712, which
Florent suggested might be related. Can you please re-test this to see if it
still exists, and if it does, bug me and I'll try to get some more movement on
Florent Xicluna la...@yahoo.fr added the comment:
Note: the fix in test_linecache.py is useless.
The with open(source_name, 'w') as source: context manager is in charge of
closing the file on __exit__.
--
___
Python tracker rep...@bugs.python.org
Florent Xicluna la...@yahoo.fr added the comment:
Another report of something looking very similar on #7712.
--
nosy: +brian.curtin, flox
priority: low - high
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
New submission from Andrew Svetlov andrew.svet...@gmail.com:
On Windows there are tiny delay between call to os.unlink and real file
removing. Periodically it leads to unittest crashes in cases like this:
test.support.unlink(filename)
f = open(filename, 'wb')
Proposed solution: wait in
Andrew Svetlov andrew.svet...@gmail.com added the comment:
patch for python 2 is attached
--
Added file: http://bugs.python.org/file15455/python2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
Andrew Svetlov andrew.svet...@gmail.com added the comment:
Problem can be reproduced with several run of test_bufio in both python
versions. trunk contains more tests (+1 test case) so it's easer to catch
'access denied' exception on it.
--
___
Changes by Brett Cannon br...@python.org:
--
keywords: +needs review
priority: - low
stage: - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7443
___
Martin v. Löwis mar...@v.loewis.de added the comment:
I'm fairly skeptical that your analysis is right. Can you prove that a
file still exists after unlink returns?
--
nosy: +loewis
___
Python tracker rep...@bugs.python.org
Andrew Svetlov andrew.svet...@gmail.com added the comment:
You right, problem is not in os.unlink (Windows call DeleteFile) itself.
I have TortoiseSVN (very popular Explorer extension to work with
Subversion) installed.
This tool run TSVNCache.exe process to update own data in background.
40 matches
Mail list logo