Bug 1801247

Summary: python-certbot-dns-rfc2136 fails to build with Python 3.9: base64.decodestring() was removed (python-dns still uses it)
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-dnsAssignee: Paul Wouters <pwouters>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aviso, cstratak, esm, fschwarz, louiz, mhroncok, paul, pspacek, pwouters, tir.karthi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-16 18:41:43 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, 1824036    

Description Miro Hrončok 2020-02-10 14:00:54 UTC
python-certbot-dns-rfc2136 fails to build with Python 3.9.0a3.

>           secret = base64.decodestring(maybe_encode(textring[keytext]))
E           AttributeError: module 'base64' has no attribute 'decodestring'

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

"base64.encodestring() and base64.decodestring(), aliases deprecated since Python 3.1, have been removed: use base64.encodebytes() and base64.decodebytes() instead."


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

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

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 Felix Schwarz 2020-02-10 14:17:21 UTC
____________________ RFC2136ClientTest.test_add_txt_record _____________________
self = <dns_rfc2136_test.RFC2136ClientTest testMethod=test_add_txt_record>
    def setUp(self):
        from certbot_dns_rfc2136._internal.dns_rfc2136 import _RFC2136Client
    
>       self.rfc2136_client = _RFC2136Client(SERVER, PORT, NAME, SECRET, dns.tsig.HMAC_MD5)
tests/dns_rfc2136_test.py:78: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
certbot_dns_rfc2136/_internal/dns_rfc2136.py:97: in __init__
    self.keyring = dns.tsigkeyring.from_text({
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
textring = {'a-tsig-key.': 'SSB3b25kZXIgd2hvIHdpbGwgYm90aGVyIHRvIGRlY29kZSB0aGlzIHRleHQK'}
    def from_text(textring):
        """Convert a dictionary containing (textual DNS name, base64 secret) pairs
        into a binary keyring which has (dns.name.Name, binary secret) pairs.
        @rtype: dict"""
    
        keyring = {}
        for keytext in textring:
            keyname = dns.name.from_text(keytext)
>           secret = base64.decodestring(maybe_encode(textring[keytext]))
E           AttributeError: module 'base64' has no attribute 'decodestring'
/usr/lib/python3.9/site-packages/dns/tsigkeyring.py:35: AttributeError

I think this is a problem in python-dns. Feel free to reassign back to python-certbot-dns-rfc2136 if I am mistaken.

Comment 2 Paul Howarth 2020-02-10 14:38:10 UTC
Looks like base64.decodestring is a deprecated (since 3.1) alias of base64.decodebytes.

https://docs.python.org/3/library/base64.html

Comment 3 Miro Hrončok 2020-02-10 14:46:12 UTC
> Looks like base64.decodestring is a deprecated (since 3.1) alias of base64.decodebytes.

Yes, sorry is this got lost in the long bugreport:

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

"base64.encodestring() and base64.decodestring(), aliases deprecated since Python 3.1, have been removed: use base64.encodebytes() and base64.decodebytes() instead."

Comment 4 Karthikeyan Singaravelan 2020-02-10 16:54:56 UTC
python-dns was fixed upstream : https://github.com/rthalley/dnspython/commit/f93c8c6ad41d38ccd19335a5a0a396cbaa409caf

Comment 5 Ben Cotton 2020-02-11 16:32:33 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-02-27 09:58:42 UTC
Paul, could you please fix this?

Comment 7 Fedora Update System 2020-04-16 17:13:11 UTC
FEDORA-2020-aaaa504a87 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-aaaa504a87

Comment 8 Fedora Update System 2020-04-16 19:29:47 UTC
FEDORA-2020-aaaa504a87 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-aaaa504a87`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-aaaa504a87

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.