[New-bugs-announce] [issue34308] shutil.copystat fails in dockered Linux (Debian) on Azure (Windows)

Chantal Ackermann report at bugs.python.org
Wed Aug 1 10:51:51 EDT 2018


New submission from Chantal Ackermann <chantal.ackermann at web.de>:

root:/media/documents# df -h
Filesystem                Size      Used Available Use% Mounted on
overlay                  29.0G     24.0G      5.0G  83% /
tmpfs                     1.7G         0      1.7G   0% /dev
tmpfs                     1.7G         0      1.7G   0% /sys/fs/cgroup
//storage01.file.core.windows.net/kubernetes-dynamic-pvc-526aa3da-6993-11e8-8c6f-0a58ac1f00ad
                          1.0G    384.0K   1023.6M   0% /media
root:/media/documents# ls -al
insgesamt 267
drwxrwxrwx 2 1000 1000      0 Jul 31 15:29 .
drwxrwxrwx 2 1000 1000      0 Jul 31 15:29 ..
-rwxrwxrwx 1 1000 1000 136479 Jul 31 16:48 orig.pdf
-rwxrwxrwx 1 1000 1000 136479 Jul 31 15:29 testfile
root:/media/documents# lsattr 
--S-----c-jI------- ./orig.pdf
--S-----c-jI------- ./testfile
root:/media/documents# python
Python 3.6.6 (default, Jul 17 2018, 11:12:33) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.copystat('orig.pdf', 'testfile')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/shutil.py", line 225, in copystat
    _copyxattr(src, dst, follow_symlinks=follow)
  File "/usr/local/lib/python3.6/shutil.py", line 157, in _copyxattr
    names = os.listxattr(src, follow_symlinks=follow_symlinks)
OSError: [Errno 38] Function not implemented: 'orig.pdf'
>>> shutil.copystat('orig.pdf', 'testfile', follow_symlinks=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/shutil.py", line 225, in copystat
    _copyxattr(src, dst, follow_symlinks=follow)
  File "/usr/local/lib/python3.6/shutil.py", line 157, in _copyxattr
    names = os.listxattr(src, follow_symlinks=follow_symlinks)
OSError: [Errno 38] Function not implemented: 'orig.pdf'
>>> 

shutil.py#164ff:

if hasattr(os, 'listxattr'):
    def _copyxattr(src, dst, *, follow_symlinks=True):
        try:
            names = os.listxattr(src, follow_symlinks=follow_symlinks)
        except OSError as e:
            if e.errno not in (errno.ENOTSUP, errno.ENODATA):
                raise
            return

=> This is true inside the docker container. However, calling os.listxattr fails with errno.ENOSYS (Error 38).

The documentation states that "copystat() never returns failure."

StackOverflow link: https://stackoverflow.com/questions/51616058/shutil-copystat-fails-inside-docker-on-azure#51635427

I can provide a pull request, if it is OK to add errno.ENOSYS to the list of ignored errors. (Would be a similar fix to the one provided for https://bugs.python.org/issue24564 (https://github.com/python/cpython/pull/8601).)

----------
components: Library (Lib)
messages: 322866
nosy: nuarhu
priority: normal
severity: normal
status: open
title: shutil.copystat fails in dockered Linux (Debian) on Azure (Windows)
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34308>
_______________________________________


More information about the New-bugs-announce mailing list