Bug ID | 1155839 |
---|---|
Summary | Python 3.8 regression: endless loop in shutil.copytree |
Classification | openSUSE |
Product | openSUSE Tumbleweed |
Version | Current |
Hardware | Other |
OS | Other |
Status | NEW |
Severity | Normal |
Priority | P5 - None |
Component | Basesystem |
Assignee | tchvatal@suse.com |
Reporter | suse-beta@cboltz.de |
QA Contact | qa-bugs@suse.de |
Found By | --- |
Blocker | --- |
The following test script works with Python 3.7 (and older), but triggers an endless loop with Python 3.8 (as currently available in Staging:A) #!/usr/bin/python3 import shutil import os os.mkdir('/dev/shm/t') os.mkdir('/dev/shm/t/policygroups') with open('/dev/shm/t/policygroups/pol', 'w+') as f: f.write('pol') shutil.copytree('/dev/shm/t/policygroups', '/dev/shm/t/policygroups/somevendor/1.0') The important point is probably that 'policygroups' gets copied into a subdirectory of itsself. While this worked in Python up to 3.7, doing the same in Python 3.8 runs into an endless loop: [ 18s] + python3 /home/abuild/rpmbuild/SOURCES/test.py [ 18s] Traceback (most recent call last): [ 18s] File "/home/abuild/rpmbuild/SOURCES/test.py", line 15, in <module> [ 18s] shutil.copytree('/dev/shm/t/policygroups', '/dev/shm/t/policygroups/somevendor/1.0') [ 18s] File "/usr/lib/python3.8/shutil.py", line 547, in copytree [ 18s] return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks, [ 18s] File "/usr/lib/python3.8/shutil.py", line 486, in _copytree [ 18s] copytree(srcobj, dstname, symlinks, ignore, copy_function, ... [ 20s] copytree(srcobj, dstname, symlinks, ignore, copy_function, [ 20s] File "/usr/lib/python3.8/shutil.py", line 547, in copytree [ 20s] return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks, [ 20s] File "/usr/lib/python3.8/shutil.py", line 449, in _copytree [ 20s] os.makedirs(dst, exist_ok=dirs_exist_ok) [ 20s] File "/usr/lib/python3.8/os.py", line 206, in makedirs [ 20s] head, tail = path.split(name) [ 20s] File "/usr/lib/python3.8/posixpath.py", line 104, in split [ 20s] sep = _get_sep(p) [ 20s] File "/usr/lib/python3.8/posixpath.py", line 42, in _get_sep [ 20s] if isinstance(path, bytes): [ 20s] RecursionError: maximum recursion depth exceeded while calling a Python object [ 20s] error: Bad exit status from /var/tmp/rpm-tmp.GsRcIW (%build) You can find the full build log in OBS home:cboltz:branches:openSUSE:Factory:Rings:1-MinimalX/copytree I also linked the package into home:cboltz/copytree where it happily builds for current Factory (with Python 3.7) and several Leap releases. BTW: In case you wonder how I found this bug - this testscript is a simplified version of an AppArmor testcase.