mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Ignore .nfs* files in distutils (#7719).
These files are created by some NFS clients a file is edited and removed concurrently (see added link in doc for more info). If such a file is removed between distutils calls listdir and copy, it will get confused. Other special files are ignored in sdist (namely VCS directories), but this has to be filtered out earlier.
This commit is contained in:
parent
96534689a8
commit
3cf202e957
6 changed files with 36 additions and 5 deletions
|
@ -101,6 +101,24 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
|
|||
remove_tree(self.root_target, verbose=0)
|
||||
remove_tree(self.target2, verbose=0)
|
||||
|
||||
def test_copy_tree_skips_nfs_temp_files(self):
|
||||
mkpath(self.target, verbose=0)
|
||||
|
||||
a_file = os.path.join(self.target, 'ok.txt')
|
||||
nfs_file = os.path.join(self.target, '.nfs123abc')
|
||||
for f in a_file, nfs_file:
|
||||
fh = open(f, 'w')
|
||||
try:
|
||||
fh.write('some content')
|
||||
finally:
|
||||
fh.close()
|
||||
|
||||
copy_tree(self.target, self.target2)
|
||||
self.assertEqual(os.listdir(self.target2), ['ok.txt'])
|
||||
|
||||
remove_tree(self.root_target, verbose=0)
|
||||
remove_tree(self.target2, verbose=0)
|
||||
|
||||
def test_ensure_relative(self):
|
||||
if os.sep == '/':
|
||||
self.assertEqual(ensure_relative('/home/foo'), 'home/foo')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue