Issue2314

classification
Title: test_shutil failures on Windows
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: jeff.allen, pekka.klarck, zyasoft
Priority: Keywords: test failure causes

Created on 2015-04-06.20:06:05 by jeff.allen, last changed 2017-03-07.20:05:45 by jeff.allen.

Messages
msg9772 (view) Author: Jeff Allen (jeff.allen) Date: 2015-04-06.20:06:04
Observed in Jython 2.7rc2 on Windows 7:

> jython -m test.test_shutil
test_copytree_simple (__main__.TestShutil) ... ERROR
test_copytree_with_exclude (__main__.TestShutil) ... ERROR
...

======================================================================
ERROR: test_copytree_simple (__main__.TestShutil)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\jython\2.7rc2\Lib\test\test_shutil.py", line 165, in test_copytree_simple
    shutil.copytree(src_dir, dst_dir)
  File "C:\jython\2.7rc2\Lib\shutil.py", line 208, in copytree
    raise Error, errors
Error: [('c:\\users\\jeff\\appdata\\local\\temp\\tmpuusegz\\test_dir', 'c:\\users\\jeff\\appdata\\local\\temp\\tmp6qg7jb\\destination\\test_dir', "[Errno 1] Operation not permitted: c:\\\\users\\\\jeff\\\\appdata\\\\local\\\\temp\\\\tmp6qg7jb\\\\destination\\\\test_dir'"), ('c:\\users\\jeff\\appdata\\local\\temp\\tmpuusegz', 'c:\\users\\jeff\\appdata\\local\\temp\\tmp6qg7jb\\destination', "[Errno 1] Operation not permitted: 'c:\\\\users\\\\jeff\\\\appdata\\\\local\\\\temp\\\\tmp6qg7jb\\\\destination'")]

======================================================================
ERROR: test_copytree_with_exclude (__main__.TestShutil)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\jython\2.7rc2\Lib\test\test_shutil.py", line 223, in test_copytree_with_exclude
    shutil.copytree(src_dir, dst_dir, ignore=patterns)
  File "C:\jython\2.7rc2\Lib\shutil.py", line 208, in copytree
    raise Error, errors
Error: [('c:\\users\\jeff\\appdata\\local\\temp\\tmp2muksu\\test_dir', 'c:\\users\\jeff\\appdata\\local\\temp\\tmpbomk3f\\destination\\test_dir', "[Errno 1] Operation not permitted: 'c:\\\\users\\\\jeff\\\\appdata\\\\local\\\\temp\\\\tmpbomk3f\\\\destination\\\\test_dir'"), ('c:\\users\\jeff\\appdata\\local\\temp\\tmp2muksu', 'c:\\users\\jeff\\appdata\\local\\temp\\tmpbomk3f\\destination', "[Errno 1] Operation not permitted: 'c:\\\\users\\\\jeff\\\\appdata\\\\local\\\\temp\\\\tmpbomk3f\\\\destination'")]

----------------------------------------------------------------------
Ran 28 tests in 0.718s

May be related to un-closed files. Just possibly related to #2307.
msg10774 (view) Author: Pekka Klärck (pekka.klarck) Date: 2016-02-24.09:20:29
It seems shutil.copytree is broken on Windows. See #2474.
msg10918 (view) Author: Jeff Allen (jeff.allen) Date: 2016-08-27.17:38:56
My observation of #2314 is that setReadonly() reports failure when the target is a directory. It seems this is because the simple DOS read-only flag on a directory doesn't mean what Java means by read-only, it means "don't delete me". So making a directory read-only in the Java sense cannot succeed. See:

http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6728842

I think is at least a contributory factor in #2474 as Pekka suggests.

A proper solution involves ACLs. For now, ignoring the read-only for directories seems most consistent. And it makes the regression test pass.
msg11202 (view) Author: Jeff Allen (jeff.allen) Date: 2017-03-07.20:05:45
Fixed ages ago in https://hg.python.org/jython/rev/c168765aae66 with no come-back.
History
Date User Action Args
2017-03-07 20:05:45jeff.allensetstatus: open -> closed
resolution: fixed
messages: + msg11202
2016-08-27 17:38:56jeff.allensetassignee: jeff.allen
messages: + msg10918
nosy: + zyasoft
2016-02-24 09:20:29pekka.klarcksetnosy: + pekka.klarck
messages: + msg10774
2015-04-06 20:06:05jeff.allencreate