Skip to content

gh-83074: Ignore EACCES, ENOSYS in copyxattr#21430

Open
tiran wants to merge 1 commit into
python:mainfrom
tiran:bpo-38893-xattr
Open

gh-83074: Ignore EACCES, ENOSYS in copyxattr#21430
tiran wants to merge 1 commit into
python:mainfrom
tiran:bpo-38893-xattr

Conversation

@tiran
Copy link
Copy Markdown
Member

@tiran tiran commented Jul 10, 2020

:func:shutil.copystat now ignores :const:errno.ENOSYS and
:const:errno.EACCES when copying extended file attributes.
:func:os.listxattr can fail with ENOSYS on some file systems (e.g. NFS).
An LSM may block :func:os.setxattr for security attributes like
security.selinux.

Signed-off-by: Christian Heimes christian@python.org

https://bugs.python.org/issue38893

:func:`shutil.copystat` now ignores :const:`errno.ENOSYS` and
:const:`errno.EACCES` when copying extended file attributes.
:func:`os.listxattr` can fail with ENOSYS on some file systems (e.g. NFS).
An LSM may block :func:`os.setxattr` for security attributes like
``security.selinux``.

Signed-off-by: Christian Heimes <christian@python.org>
@tiran
Copy link
Copy Markdown
Member Author

tiran commented Jul 10, 2020

CC @adelton, @wrabcak

@adelton
Copy link
Copy Markdown

adelton commented Jul 10, 2020

I am not sure I'm fond of silently ignoring errors -- that can have security implications since the result might not be as expected.
I'd rather see an approach where the operation (copying specific extended attributes) is not attempted at all in situations or environments where it is not supported or not expected to work. That way after copystat that passed you'd know that things are in expected shape. If you ignore the errors, in case of SELinux labels you will likely still get AVC denials on the host, so the result will be even more confusing.

@Tubbles
Copy link
Copy Markdown

Tubbles commented Feb 25, 2022

Also fixes bpo-38633

@ambv
Copy link
Copy Markdown
Contributor

ambv commented May 17, 2022

This missed the boat for inclusion in Python 3.9 which accepts security fixes only as of today.

@erlend-aasland
Copy link
Copy Markdown
Contributor

Also fixes bpo-38633

FTR, bpo-38633 (gh-82814) was fixed by:

@erlend-aasland erlend-aasland changed the title bpo-38893: Ignore EACCES, ENOSYS in copyxattr gh-83074: Ignore EACCES, ENOSYS in copyxattr Jan 4, 2024
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review stale Stale PR or inactive for long period of time. type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants