New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-24564: shutil.copystat(): ignore EINVAL on os.setxattr() #13369
Conversation
…n setting extended attributes using os.setxattr().
@@ -0,0 +1,3 @@ | |||
shutil.copystat(): ignore EINVAL on os.setxattr() which may occur when copying files on NFS filesystems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind adding markup and reword the NEWs entry? I think something like that could be good (think to use blurb
to format correctly the lines):
:func:`shutil.copystat` now ignores :const:`errno.EINVAL` on :func:`os.setxattr` which may occur when copying files on filesystems without extended attributes support. Original patch by Giampaolo Rodola, updated by Ying Wang.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds great, should be pushed
Lib/shutil.py
Outdated
raise | ||
return | ||
for name in names: | ||
try: | ||
value = os.getxattr(src, name, follow_symlinks=follow_symlinks) | ||
os.setxattr(dst, name, value, follow_symlinks=follow_symlinks) | ||
except OSError as e: | ||
if e.errno not in (errno.EPERM, errno.ENOTSUP, errno.ENODATA): | ||
if e.errno not in (errno.EPERM, | ||
errno.ENOTSUP, errno.ENODATA, errno.EINVAL): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a cosmetic/style nitpick - it's better to do this:
if e.errno not in (errno.EPERM, errno.ENOTSUP, errno.ENODATA,
errno.EINVAL):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be updated!
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Thanks @yingw787 for the PR, and @giampaolo for merging it |
Thanks @yingw787 for the PR, and @giampaolo for merging it |
GH-13673 is a backport of this pull request to the 3.7 branch. |
Sorry, @yingw787 and @giampaolo, I could not cleanly backport this to |
[First-time contribution]
Carbon copy of PR #8601, except using tuples instead of sets. New pull request needed because original repo fork no longer exists.
This pull request ignores errno.EINVAL (invalid argument) when copying over extended attributes, which may cause copy to fail when copying files from a filesystem that supports extended attributes to filesystem that does not support extended attributes.
This pull request may also address bpo-36850.
CC: @giampaolo @serhiy-storchaka @abadger
https://bugs.python.org/issue24564