Skip to content

bpo-44205: Ignore out of space errors in shutil.copystat #26282

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Lib/shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,13 @@ def _copyxattr(src, dst, *, follow_symlinks=True):
value = os.getxattr(src, name, follow_symlinks=follow_symlinks)
os.setxattr(dst, name, value, follow_symlinks=follow_symlinks)
except OSError as e:
# EINVAL can occur when the destination filesystem does not
# support extended attributed
# ENOSPC can occur when the destination filesystem has a
# smaller limit than the source filesystem for the size of
# extended attributes
if e.errno not in (errno.EPERM, errno.ENOTSUP, errno.ENODATA,
errno.EINVAL):
errno.EINVAL, errno.ENOSPC):
raise
else:
def _copyxattr(*args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :exc:`OSError` in :func:`shutil.copystat` when the destination file system doesn't have sufficient space for the source file's extended attributes.