Skip to content
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

tarfile doesn't set file modes correctly on FreeBSD: test_tarfile.test_modes() fails on FreeBSD #108948

Closed
sorcio opened this issue Sep 5, 2023 · 2 comments
Labels
needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes OS-freebsd tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@sorcio
Copy link
Contributor

sorcio commented Sep 5, 2023

Bug report

Bug description:

The best example for this is given in the regression test suite. TestExtractionFilters.test_modes in test_tarfiles fails with OSError: [Errno 79] Inappropriate file type or format on FreeBSD.

The reason is that chmod fails with EFTYPE (errno 79) when attempting to set the sticky bit (S_ISVTX) on a file when the effective user is not root. Most other platforms will just ignore the bit in chmod calls.

Tested on FreeBSD 13.2 but documentation suggests this is not a new behavior.

(Note that FreeBSD buildbots haven't been running for a while. This is probably why this issue, although it causes a test failure, hadn't been caught before)

CPython versions tested on:

3.12

Operating systems tested on:

Other

Linked PRs

@sorcio sorcio added the type-bug An unexpected behavior, bug, or error label Sep 5, 2023
@vstinner vstinner added OS-freebsd tests Tests in the Lib/test dir labels Sep 5, 2023
@vstinner vstinner changed the title tarfile doesn't set file modes correctly on FreeBSD tarfile doesn't set file modes correctly on FreeBSD: test_tarfile.test_modes() fails on FreeBSD Sep 14, 2023
@sorcio
Copy link
Contributor Author

sorcio commented Sep 18, 2023

On further assessment (thanks @encukou), this could be solely a tests issue, and not a library bug. Maybe it's okay that tarfile has different behaviors on different OSes, especially around exotic cases, and it's enough to relax the expectation in the failing test.

vstinner added a commit to vstinner/cpython that referenced this issue Sep 21, 2023
On FreeBSD, regular user cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 21, 2023
On FreeBSD, regular user cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 21, 2023
On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
vstinner added a commit that referenced this issue Sep 21, 2023
On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
vstinner added a commit to vstinner/cpython that referenced this issue Sep 21, 2023
…on#109697)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.

(cherry picked from commit 26e06ad)
vstinner added a commit that referenced this issue Sep 21, 2023
…9697) (#109699)

gh-108948: Skip test_tarfile.test_modes() on EFTYPE error (#109697)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.

(cherry picked from commit 26e06ad)
@vstinner
Copy link
Member

Fixed by skipping the test if chmod() cannot set the sticky bit.

See #108950 (comment) for the longer rationale.

csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
…on#109697)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
Yhg1s pushed a commit that referenced this issue Oct 2, 2023
…9697) (#109698)

gh-108948: Skip test_tarfile.test_modes() on EFTYPE error (#109697)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.

(cherry picked from commit 26e06ad)
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…on#109697)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
@encukou encukou added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Oct 10, 2024
encukou pushed a commit to encukou/cpython that referenced this issue Oct 10, 2024
…on#109697)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
encukou pushed a commit to encukou/cpython that referenced this issue Oct 16, 2024
…on#109697)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
pablogsal pushed a commit that referenced this issue Oct 22, 2024
…ystems that don't support them (GH-108368) (GH-109697) (#125255)

* gh-107902: Don't test setting suid/sgid on systems that don't support them (GH-108368)

* gh-108948: Skip test_tarfile.test_modes() on EFTYPE error (#109697)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.

---------

Co-authored-by: Victor Stinner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 22, 2024
…/sticky on systems that don't support them (pythonGH-108368) (pythonGH-109697) (pythonGH-125255)

* pythongh-107902: Don't test setting suid/sgid on systems that don't support them (pythonGH-108368)

* pythongh-108948: Skip test_tarfile.test_modes() on EFTYPE error (pythonGH-109697)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.

---------

(cherry picked from commit 6bbaab8)

Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
ambv pushed a commit that referenced this issue Oct 28, 2024
…stems that don't support them (GH-108368) (GH-109697) (#125576)

On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.

Co-authored-by: Victor Stinner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes OS-freebsd tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

3 participants