Bug 2266601

Summary: python-exdir fails to build with Python 3.13: NameError("Name cannot be '{}' because it is a reserved filename in Windows.")
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-exdirAssignee: Ankur Sinha (FranciscoD) <sanjay.ankur>
Status: CLOSED ERRATA QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fti-bugs, gui1ty, ksurma, mhroncok, neuro-sig, sanjay.ankur
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-exdir-0.5.0.1-7.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-15 11:35:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2244836, 2260875, 2260877, 2291692    

Description Karolina Surma 2024-02-28 12:56:52 UTC
python-exdir fails to build with Python 3.13.0a4.

=================================== FAILURES ===================================
________________________ test_assert_valid_name_minimal ________________________

setup_teardown_folder = (PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_assert_valid_name_minimal0'), PosixPath('/tmp/pytest-of-mockbuild/p...d_name_minimal0/test.exdir'), PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_assert_valid_name_minimal0/exdir_dir'))

    def test_assert_valid_name_minimal(setup_teardown_folder):
        f = exdir.File(setup_teardown_folder[1], name_validation=fv.minimal)
        exob._assert_valid_name("abcdefghijklmnopqrstuvwxyz1234567890_-", f)
        with pytest.raises(NameError):
            exob._assert_valid_name("", f)
    
        exob._assert_valid_name("A", f)
    
>       exob._assert_valid_name("\n", f)

tests/test_help_functions.py:36: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/python-exdir-0.5.0.1-4.fc41.x86_64/usr/lib/python3.13/site-packages/exdir/core/exdir_object.py:22: in _assert_valid_name
    container.file.name_validation(container.directory, name)
../../BUILDROOT/python-exdir-0.5.0.1-4.fc41.x86_64/usr/lib/python3.13/site-packages/exdir/core/validation.py:86: in minimal
    _assert_nonreserved(name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = '\n'

    def _assert_nonreserved(name):
        # NOTE ignore unicode errors, they are not reserved
        try:
            name_str = str(name)
        except UnicodeEncodeError:
            name_str = name.encode('utf8')
    
        reserved_names = [
            exob.META_FILENAME,
            exob.ATTRIBUTES_FILENAME,
            exob.RAW_FOLDER_NAME
        ]
    
        if name_str in reserved_names:
            raise NameError(
                "Name cannot be '{}' because it is a reserved filename in Exdir.".format(name_str)
            )
    
        if pathlib.PureWindowsPath(name_str).is_reserved():
>           raise NameError(
                "Name cannot be '{}' because it is a reserved filename in Windows.".format(name_str)
            )
E           NameError: Name cannot be '
E           ' because it is a reserved filename in Windows.

../../BUILDROOT/python-exdir-0.5.0.1-4.fc41.x86_64/usr/lib/python3.13/site-packages/exdir/core/validation.py:62: NameError
=========================== short test summary info ============================
FAILED tests/test_help_functions.py::test_assert_valid_name_minimal - NameErr...
================= 1 failed, 170 passed, 411 warnings in 2.22s ==================

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/07067764-python-exdir/

For all our attempts to build python-exdir with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-exdir/

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.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
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 Sandro 2024-03-28 14:40:44 UTC
This fails due to method `is_reserved()` behaving differently in Python 3.13 as documented upstream[1]. In addition the method is deprecated as of Python 3.13 and will be removed in Python 3.15.

I've reported the issue upstream in order to let them choose a path forward. If push comes to shove, we can disable the failing test downstream until a fix has been provided.

[1] https://docs.python.org/3.13/library/pathlib.html#pathlib.PurePath.is_reserved

Comment 2 Karolina Surma 2024-06-12 15:01:37 UTC
*** Bug 2291692 has been marked as a duplicate of this bug. ***

Comment 3 Fedora Update System 2024-06-15 11:30:49 UTC
FEDORA-2024-b95acde0a0 (python-exdir-0.5.0.1-7.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-b95acde0a0

Comment 4 Fedora Update System 2024-06-15 11:35:23 UTC
FEDORA-2024-b95acde0a0 (python-exdir-0.5.0.1-7.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.