[issue24538] os.setxattr PermissionError on panfs propagates up causing `copystat`, `copytree`, and `pip install .` to fail unhepfully

Gerrit Holl report at bugs.python.org
Tue Jun 30 14:07:21 CEST 2015


New submission from Gerrit Holl:

`shutil.copystat` fails on [panfs](https://en.wikipedia.org/wiki/Panasas#PanFS) if the source file lacks u+w, because setting extended attributes results in a `PermissionError`.  This leads to higher end functions such as `shutil.copytree` to fail.  More seriously, it leads to `pip install .` to fail, as I [reported here](https://github.com/pypa/pip/issues/2941):

    In [55]: shutil.copystat("/src/on/panfs", "/tmp/fubar")
    ---------------------------------------------------------------------------
    PermissionError                           Traceback (most recent call last)
    <ipython-input-55-139c9fc77184> in <module>()
    ----> 1 shutil.copystat("/home/users/gholl/checkouts/pyatmlab/.git/objects/pack/pack-c1449559ec4287b3830efe2913608dddf2f21391.pack", "/tmp/fubar")
    
    /home/users/gholl/lib/python3.4/shutil.py in copystat(src, dst, follow_symlinks)
        211             else:
        212                 raise
    --> 213     _copyxattr(src, dst, follow_symlinks=follow)
        214
        215 def copy(src, dst, *, follow_symlinks=True):
    
    /home/users/gholl/lib/python3.4/shutil.py in _copyxattr(src, dst, follow_symlinks)
        151             try:
        152                 value = os.getxattr(src, name, follow_symlinks=follow_symlinks)
    --> 153                 os.setxattr(dst, name, value, follow_symlinks=follow_symlinks)
        154             except OSError as e:
        155                 if e.errno not in (errno.EPERM, errno.ENOTSUP, errno.ENODATA):
    
    PermissionError: [Errno 13] Permission denied: '/tmp/fubar'

This occurs for any source file where the user write bit is not set.

Now, I'm not sure if this should be addressed in `pip`, `shutil.copytree`, `shutil.copystat`, `setxattr`, `panfs`, or in none of the above.  I'm reporting it in different places; please close this issue if this is the wrong place.

----------
components: Library (Lib)
messages: 245985
nosy: Gerrit.Holl
priority: normal
severity: normal
status: open
title: os.setxattr PermissionError on panfs propagates up causing `copystat`, `copytree`, and `pip install .` to fail unhepfully
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24538>
_______________________________________


More information about the Python-bugs-list mailing list