Bug 1796024

Summary: python-libnacl fails to build with Python 3.9: encoding parameter of json.loads() has been removed
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-libnaclAssignee: Jonny Heggheim <hegjon>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, hegjon, mhroncok, pviktori, tir.karthi
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 1.7.1-3.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-02 11:36:56 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: 1785415    

Description Miro Hrončok 2020-01-29 12:36:32 UTC
python-libnacl fails to build with Python 3.9.0a3.

ERROR: test_save_load (unit.test_save.TestSave)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/libnacl-1.7.1/tests/unit/test_save.py", line 32, in test_save_load
    bob_load = libnacl.utils.load_key(bob_path)
  File "/builddir/build/BUILD/libnacl-1.7.1/libnacl/utils.py", line 34, in load_key
    key_data = json.loads(stream.read(), encoding='UTF-8')
  File "/usr/lib64/python3.9/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
TypeError: __init__() got an unexpected keyword argument 'encoding'
======================================================================
ERROR: test_save_load_secret (unit.test_save.TestSave)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/libnacl-1.7.1/tests/unit/test_save.py", line 63, in test_save_load_secret
    lbox = libnacl.utils.load_key(box_path)
  File "/builddir/build/BUILD/libnacl-1.7.1/libnacl/utils.py", line 34, in load_key
    key_data = json.loads(stream.read(), encoding='UTF-8')
  File "/usr/lib64/python3.9/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
TypeError: __init__() got an unexpected keyword argument 'encoding'
======================================================================
ERROR: test_save_load_sign (unit.test_save.TestSave)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/libnacl-1.7.1/tests/unit/test_save.py", line 74, in test_save_load_sign
    signer_load = libnacl.utils.load_key(sign_path)
  File "/builddir/build/BUILD/libnacl-1.7.1/libnacl/utils.py", line 34, in load_key
    key_data = json.loads(stream.read(), encoding='UTF-8')
  File "/usr/lib64/python3.9/json/__init__.py", line 359, in loads
    return cls(**kw).decode(s)
TypeError: __init__() got an unexpected keyword argument 'encoding'


See https://docs.python.org/3.9/whatsnew/3.9.html#removed

"The encoding parameter of json.loads() has been removed. As of Python 3.1, it was deprecated and ignored; using it has emitted a DeprecationWarning since Python 3.8."



For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01198911-python-libnacl/

For all our attempts to build python-libnacl with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/python-libnacl/

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

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.9.
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 Karthikeyan Singaravelan 2020-01-29 17:15:59 UTC
Upstream issue : https://github.com/saltstack/libnacl/issues/120 . I will raise a PR .

Comment 2 Sergio Basto 2020-01-29 17:52:54 UTC
please send me a PR via https://src.fedoraproject.org/rpms/python-libnacl/pull-requests

Comment 3 Karthikeyan Singaravelan 2020-01-30 19:40:20 UTC
Upstream PR : https://github.com/saltstack/libnacl/pull/121 . Sorry, is there documentation on how to send PRs to fedora? I couldn't see the source or where to patch/test it.

Comment 4 Miro Hrončok 2020-01-30 20:30:33 UTC
That requires knowledge of packaging. Patches are usually added like this:

https://src.fedoraproject.org/rpms/pytest/c/df813420f685f37e472f5ee1a0f0f3e560004613?branch=master


PRs can be done wither via https://src.fedoraproject.org forks or via a "third party PR" pagure feature from any external git repo with public URL and shared history.

Comment 5 Ben Cotton 2020-02-11 17:21:59 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.

Comment 6 Miro Hrončok 2020-03-16 13:47:57 UTC
Karthikeyan, how can I help with that PR?

Comment 7 Karthikeyan Singaravelan 2020-03-16 15:59:29 UTC
Sorry, I didn't have the time to make a PR to fedora package. The upstream PR is merged and is simple feel free to backport as needed.

Comment 8 Petr Viktorin (pviktori) 2020-04-01 16:22:36 UTC
https://src.fedoraproject.org/rpms/python-libnacl/pull-request/1

Comment 9 Jonny Heggheim 2020-04-01 20:22:01 UTC
(In reply to Petr Viktorin from comment #8)
> https://src.fedoraproject.org/rpms/python-libnacl/pull-request/1

Pull request have been merged.

Koji build: https://koji.fedoraproject.org/koji/taskinfo?taskID=42953205

Comment 10 Miro Hrončok 2020-04-01 20:44:07 UTC
Thank you all.

Comment 11 Jonny Heggheim 2020-04-01 20:45:18 UTC
(In reply to Miro Hrončok from comment #10)
> Thank you all.

The build failed on Koji, but worked on in my local mock build. Not sure... maybe another bug?

Comment 12 Miro Hrončok 2020-04-01 20:47:18 UTC
There is a segfault. I think it depends on architecture. I assume your mock is x86_64, the build was on armv7.

Comment 13 Jonny Heggheim 2020-04-01 20:49:34 UTC
(In reply to Miro Hrončok from comment #12)
> There is a segfault. I think it depends on architecture. I assume your mock
> is x86_64, the build was on armv7.

Yes, fedora-rawhide-x86_64

Comment 14 Miro Hrončok 2020-04-01 21:02:12 UTC
You can try to build until it hits an architecture that passes. I also suggest to file another bug fro you package that it fails to build on arch.

Comment 15 Petr Viktorin (pviktori) 2020-04-02 10:51:39 UTC
This is actually a subtle upstream bug: https://github.com/saltstack/libnacl/issues/123

Comment 16 Petr Viktorin (pviktori) 2020-04-02 11:36:56 UTC
Closing this because the "encoding parameter of json.loads() has been removed" part is fixed. Having this bug closed allows us to track more potential Python 3.9 failures.

I opened https://bugzilla.redhat.com/show_bug.cgi?id=1820150 for the ARM FTBFS.