Bug 2359502 - pylibacl fails to build with Python 3.14: tests/test_acls.py::TestModification: Failed: Wrong reference count, expected 2-1024 and got 1 [NEEDINFO]
Summary: pylibacl fails to build with Python 3.14: tests/test_acls.py::TestModificatio...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: pylibacl
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Marcin Zajaczkowski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2371780 (view as bug list)
Depends On:
Blocks: PYTHON3.14 F43FTBFS, RAWHIDEFTBFS F43FailsToInstall, RAWHIDEFailsToInstall
TreeView+ depends on / blocked
 
Reported: 2025-04-14 13:35 UTC by Karolina Surma
Modified: 2025-07-13 12:39 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:
mszpak: needinfo? (ksurma)


Attachments (Terms of Use)

Description Karolina Surma 2025-04-14 13:35:23 UTC
pylibacl fails to build with Python 3.14.0a7.

=================================== FAILURES ===================================
__________________________ TestModification.test_str ___________________________

self = <test_acls.TestModification object at 0x7f42405dc410>

    def test_str(self):
        """Test str() of an ACL."""
        acl = posix1e.ACL(text=BASIC_ACL_TEXT)
        str_acl = str(acl)
>       self.checkRef(str_acl)

tests/test_acls.py:580: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_acls.TestModification object at 0x7f42405dc410>
obj = 'user::rw-\ngroup::r--\nother::---\n'

    def checkRef(self, obj):
        """Checks if a given obj has a 'sane' refcount"""
        if platform.python_implementation() == "PyPy":
            return
        ref_cnt = sys.getrefcount(obj)
        # FIXME: hardcoded value for the max ref count... but I've
        # seen it overflow on bad reference counting, so it's better
        # to be safe
        if ref_cnt < 2 or ref_cnt > 1024:
>           pytest.fail("Wrong reference count, expected 2-1024 and got %d" %
                        ref_cnt)
E           Failed: Wrong reference count, expected 2-1024 and got 1

tests/test_acls.py:573: Failed
_________________________ TestModification.test_append _________________________

self = <test_acls.TestModification object at 0x7f42405dc550>

    def test_append(self):
        """Test append a new Entry to the ACL"""
        acl = posix1e.ACL()
        e = acl.append()
        e.tag_type = posix1e.ACL_OTHER
        ignore_ioerror(errno.EINVAL, acl.calc_mask)
        str_format = str(e)
>       self.checkRef(str_format)

tests/test_acls.py:589: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_acls.TestModification object at 0x7f42405dc550>
obj = 'ACL entry for the others'

    def checkRef(self, obj):
        """Checks if a given obj has a 'sane' refcount"""
        if platform.python_implementation() == "PyPy":
            return
        ref_cnt = sys.getrefcount(obj)
        # FIXME: hardcoded value for the max ref count... but I've
        # seen it overflow on bad reference counting, so it's better
        # to be safe
        if ref_cnt < 2 or ref_cnt > 1024:
>           pytest.fail("Wrong reference count, expected 2-1024 and got %d" %
                        ref_cnt)
E           Failed: Wrong reference count, expected 2-1024 and got 1

tests/test_acls.py:573: Failed
_____________________ TestModification.test_entry_creation _____________________

self = <test_acls.TestModification object at 0x7f4240b7dfd0>

    def test_entry_creation(self):
        acl = posix1e.ACL()
        e = posix1e.Entry(acl)
        ignore_ioerror(errno.EINVAL, acl.calc_mask)
        str_format = str(e)
>       self.checkRef(str_format)

tests/test_acls.py:616: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_acls.TestModification object at 0x7f4240b7dfd0>
obj = 'ACL entry for undefined type'

    def checkRef(self, obj):
        """Checks if a given obj has a 'sane' refcount"""
        if platform.python_implementation() == "PyPy":
            return
        ref_cnt = sys.getrefcount(obj)
        # FIXME: hardcoded value for the max ref count... but I've
        # seen it overflow on bad reference counting, so it's better
        # to be safe
        if ref_cnt < 2 or ref_cnt > 1024:
>           pytest.fail("Wrong reference count, expected 2-1024 and got %d" %
                        ref_cnt)
E           Failed: Wrong reference count, expected 2-1024 and got 1

tests/test_acls.py:573: Failed
_____________________ TestModification.test_permset[read] ______________________

self = <test_acls.TestModification object at 0x7f42405cee40>, perm = 4
txt = 'read'

    @pytest.mark.parametrize("perm, txt, accessor",
                             PERMSETS, ids=PERMSETS_IDS)
    def test_permset(self, perm, txt, accessor):
        """Test permissions"""
        del accessor
        acl = posix1e.ACL()
        e = acl.append()
        ps = e.permset
        ps.clear()
        str_ps = str(ps)
>       self.checkRef(str_ps)

tests/test_acls.py:831: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_acls.TestModification object at 0x7f42405cee40>, obj = '---'

    def checkRef(self, obj):
        """Checks if a given obj has a 'sane' refcount"""
        if platform.python_implementation() == "PyPy":
            return
        ref_cnt = sys.getrefcount(obj)
        # FIXME: hardcoded value for the max ref count... but I've
        # seen it overflow on bad reference counting, so it's better
        # to be safe
        if ref_cnt < 2 or ref_cnt > 1024:
>           pytest.fail("Wrong reference count, expected 2-1024 and got %d" %
                        ref_cnt)
E           Failed: Wrong reference count, expected 2-1024 and got 1

tests/test_acls.py:573: Failed
_____________________ TestModification.test_permset[write] _____________________

self = <test_acls.TestModification object at 0x7f424062ef30>, perm = 2
txt = 'write'

    @pytest.mark.parametrize("perm, txt, accessor",
                             PERMSETS, ids=PERMSETS_IDS)
    def test_permset(self, perm, txt, accessor):
        """Test permissions"""
        del accessor
        acl = posix1e.ACL()
        e = acl.append()
        ps = e.permset
        ps.clear()
        str_ps = str(ps)
>       self.checkRef(str_ps)

tests/test_acls.py:831: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_acls.TestModification object at 0x7f424062ef30>, obj = '---'

    def checkRef(self, obj):
        """Checks if a given obj has a 'sane' refcount"""
        if platform.python_implementation() == "PyPy":
            return
        ref_cnt = sys.getrefcount(obj)
        # FIXME: hardcoded value for the max ref count... but I've
        # seen it overflow on bad reference counting, so it's better
        # to be safe
        if ref_cnt < 2 or ref_cnt > 1024:
>           pytest.fail("Wrong reference count, expected 2-1024 and got %d" %
                        ref_cnt)
E           Failed: Wrong reference count, expected 2-1024 and got 1

tests/test_acls.py:573: Failed
____________________ TestModification.test_permset[execute] ____________________

self = <test_acls.TestModification object at 0x7f424062ef90>, perm = 1
txt = 'execute'

    @pytest.mark.parametrize("perm, txt, accessor",
                             PERMSETS, ids=PERMSETS_IDS)
    def test_permset(self, perm, txt, accessor):
        """Test permissions"""
        del accessor
        acl = posix1e.ACL()
        e = acl.append()
        ps = e.permset
        ps.clear()
        str_ps = str(ps)
>       self.checkRef(str_ps)

tests/test_acls.py:831: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_acls.TestModification object at 0x7f424062ef90>, obj = '---'

    def checkRef(self, obj):
        """Checks if a given obj has a 'sane' refcount"""
        if platform.python_implementation() == "PyPy":
            return
        ref_cnt = sys.getrefcount(obj)
        # FIXME: hardcoded value for the max ref count... but I've
        # seen it overflow on bad reference counting, so it's better
        # to be safe
        if ref_cnt < 2 or ref_cnt > 1024:
>           pytest.fail("Wrong reference count, expected 2-1024 and got %d" %
                        ref_cnt)
E           Failed: Wrong reference count, expected 2-1024 and got 1

tests/test_acls.py:573: Failed
______________ TestModification.test_permset_via_accessors[read] _______________

self = <test_acls.TestModification object at 0x7f42405d0780>, perm = 4
txt = 'read', accessor = <attribute 'read' of 'posix1e.Permset' objects>

    @pytest.mark.parametrize("perm, txt, accessor",
                             PERMSETS, ids=PERMSETS_IDS)
    def test_permset_via_accessors(self, perm, txt, accessor):
        """Test permissions"""
        acl = posix1e.ACL()
        e = acl.append()
        ps = e.permset
        ps.clear()
        def getter():
            return accessor.__get__(ps) # type: ignore
        def setter(value):
            return accessor.__set__(ps, value) # type: ignore
        str_ps = str(ps)
>       self.checkRef(str_ps)

tests/test_acls.py:864: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_acls.TestModification object at 0x7f42405d0780>, obj = '---'

    def checkRef(self, obj):
        """Checks if a given obj has a 'sane' refcount"""
        if platform.python_implementation() == "PyPy":
            return
        ref_cnt = sys.getrefcount(obj)
        # FIXME: hardcoded value for the max ref count... but I've
        # seen it overflow on bad reference counting, so it's better
        # to be safe
        if ref_cnt < 2 or ref_cnt > 1024:
>           pytest.fail("Wrong reference count, expected 2-1024 and got %d" %
                        ref_cnt)
E           Failed: Wrong reference count, expected 2-1024 and got 1

tests/test_acls.py:573: Failed
______________ TestModification.test_permset_via_accessors[write] ______________

self = <test_acls.TestModification object at 0x7f42405d0820>, perm = 2
txt = 'write', accessor = <attribute 'write' of 'posix1e.Permset' objects>

    @pytest.mark.parametrize("perm, txt, accessor",
                             PERMSETS, ids=PERMSETS_IDS)
    def test_permset_via_accessors(self, perm, txt, accessor):
        """Test permissions"""
        acl = posix1e.ACL()
        e = acl.append()
        ps = e.permset
        ps.clear()
        def getter():
            return accessor.__get__(ps) # type: ignore
        def setter(value):
            return accessor.__set__(ps, value) # type: ignore
        str_ps = str(ps)
>       self.checkRef(str_ps)

tests/test_acls.py:864: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_acls.TestModification object at 0x7f42405d0820>, obj = '---'

    def checkRef(self, obj):
        """Checks if a given obj has a 'sane' refcount"""
        if platform.python_implementation() == "PyPy":
            return
        ref_cnt = sys.getrefcount(obj)
        # FIXME: hardcoded value for the max ref count... but I've
        # seen it overflow on bad reference counting, so it's better
        # to be safe
        if ref_cnt < 2 or ref_cnt > 1024:
>           pytest.fail("Wrong reference count, expected 2-1024 and got %d" %
                        ref_cnt)
E           Failed: Wrong reference count, expected 2-1024 and got 1

tests/test_acls.py:573: Failed
_____________ TestModification.test_permset_via_accessors[execute] _____________

self = <test_acls.TestModification object at 0x7f42405d08c0>, perm = 1
txt = 'execute', accessor = <attribute 'execute' of 'posix1e.Permset' objects>

    @pytest.mark.parametrize("perm, txt, accessor",
                             PERMSETS, ids=PERMSETS_IDS)
    def test_permset_via_accessors(self, perm, txt, accessor):
        """Test permissions"""
        acl = posix1e.ACL()
        e = acl.append()
        ps = e.permset
        ps.clear()
        def getter():
            return accessor.__get__(ps) # type: ignore
        def setter(value):
            return accessor.__set__(ps, value) # type: ignore
        str_ps = str(ps)
>       self.checkRef(str_ps)

tests/test_acls.py:864: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_acls.TestModification object at 0x7f42405d08c0>, obj = '---'

    def checkRef(self, obj):
        """Checks if a given obj has a 'sane' refcount"""
        if platform.python_implementation() == "PyPy":
            return
        ref_cnt = sys.getrefcount(obj)
        # FIXME: hardcoded value for the max ref count... but I've
        # seen it overflow on bad reference counting, so it's better
        # to be safe
        if ref_cnt < 2 or ref_cnt > 1024:
>           pytest.fail("Wrong reference count, expected 2-1024 and got %d" %
                        ref_cnt)
E           Failed: Wrong reference count, expected 2-1024 and got 1

tests/test_acls.py:573: Failed
=========================== short test summary info ============================
FAILED tests/test_acls.py::TestModification::test_str - Failed: Wrong referen...
FAILED tests/test_acls.py::TestModification::test_append - Failed: Wrong refe...
FAILED tests/test_acls.py::TestModification::test_entry_creation - Failed: Wr...
FAILED tests/test_acls.py::TestModification::test_permset[read] - Failed: Wro...
FAILED tests/test_acls.py::TestModification::test_permset[write] - Failed: Wr...
FAILED tests/test_acls.py::TestModification::test_permset[execute] - Failed: ...
FAILED tests/test_acls.py::TestModification::test_permset_via_accessors[read]
FAILED tests/test_acls.py::TestModification::test_permset_via_accessors[write]
FAILED tests/test_acls.py::TestModification::test_permset_via_accessors[execute]
============= 9 failed, 139 passed, 3 xfailed, 1 xpassed in 0.37s ==============

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08899182-pylibacl/

For all our attempts to build pylibacl with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/pylibacl/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Marcin Zajaczkowski 2025-04-14 15:56:38 UTC
Thanks for reporting.

I reproduced the problem on the upstream CI and created an issue: https://github.com/iustin/pylibacl/issues/31

Comment 2 Karolina Surma 2025-06-11 15:55:24 UTC
*** Bug 2371780 has been marked as a duplicate of this bug. ***

Comment 3 Fedora Fails To Install 2025-06-20 19:52:15 UTC
Hello,

Please note that this comment was generated automatically by https://pagure.io/releng/blob/main/f/scripts/ftbfs-fti/follow-policy.py
If you feel that this output has mistakes, please open an issue at https://pagure.io/releng/

This package fails to install and maintainers are advised to take one of the following actions:

 - Fix this bug and close this bugzilla once the update makes it to the repository.
   (The same script that posted this comment will eventually close this bugzilla
   when the fixed package reaches the repository, so you don't have to worry about it.)

or

 - Move this bug to ASSIGNED if you plan on fixing this, but simply haven't done so yet.

or

 - Orphan the package if you no longer plan to maintain it.


If you do not take one of these actions, the process at https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/#_package_removal_for_long_standing_ftbfs_and_fti_bugs will continue.
This package may be orphaned in 7+ weeks.
This is the first reminder (step 3) from the policy.

Don't hesitate to ask for help on https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ if you are unsure how to fix this bug.

Comment 4 Marcin Zajaczkowski 2025-06-20 20:03:03 UTC
I sent w reminder to the author and promised to take a look "soon". However, he stated, it's a problem with a test itself and should not affect the production code, so the problematic tests could be disabled, if not fixed by the end of June.

Comment 5 Marcin Zajaczkowski 2025-06-20 20:03:24 UTC
and promised to take a look "soon" → and HE promised to take a look "soon"

Comment 6 Iustin Pop 2025-07-12 17:36:47 UTC
Upstream author here. Sorry, I've been terribly busy at work-work, so this fell behind. As Marcin said, this is a test that relies on Python internal, and it looks like 3.14 changed how references are counted or did some other internal optimisations. Best to disable the test for now, I'll try to see if this can be salvaged in any way or whether to disable on 3.14+, and make a new minor release with that.

Comment 7 Iustin Pop 2025-07-12 17:43:11 UTC
The reason for the changed behaviour is https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-refcount. Will see what to do about it.

Comment 8 Iustin Pop 2025-07-13 01:15:34 UTC
I've released 0.7.3 which removes this test, or if simpler, you can cherry-pick commit 64011b3c82746f641ffdb5027e4f5d508f086316.

Comment 9 Marcin Zajaczkowski 2025-07-13 12:39:32 UTC
Thanks @iustin !

I have some issues with changed SSH keys after migration and I will not be able to bump the version in Fedora anytime soon. @ksurma would you be able make a change to 0.7.3?


Note You need to log in before you can comment on or make changes to this bug.