Bug 1456673

Summary: python3-pyldap contains python3 incompatible code
Product: [Fedora] Fedora Reporter: Standa Laznicka <slaznick>
Component: python-pyldapAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 26CC: mhroncok, pviktori, python-sig, rkuska
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-pyldap-2.4.35.1-2.fc27 python-pyldap-2.4.35.1-2.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-09 19:16:37 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:

Description Standa Laznicka 2017-05-30 07:10:23 UTC
Description of problem:
python3-pyldap version in Fedora 26 is too old and is not fully python3-compatible.

Version-Release number of selected component (if applicable):
python3-pyldap-2.4.25.1-2.fc25.x86_64

How reproducible:
All the time.

Steps to Reproduce:
1. python3 -c "import ldap; ldap.schema.subentry.urlfetch('file:///iamgreat.ldif')"

Actual results:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.5/site-packages/ldap/schema/subentry.py", line 478, in urlfetch
    ldif_file = urllib.urlopen(uri)
AttributeError: module 'urllib' has no attribute 'urlopen'


Expected results:
Some kind of exception that a file does not exist/proper processing of the file if you're really the person who would have such a file.


Additional info:
This also applies for Fedora 25 but I guess that one is lost so I would like to have this fixed at least in 26. It breaks FreeIPA in python3.

For the record, this was fixed upstream:
https://github.com/pyldap/pyldap/commit/378b13c8361a12dc655146f2cd91f28bbe257599

Comment 1 Standa Laznicka 2017-05-30 07:41:19 UTC
Once the above is worked around, there is yet another python3 incompatibility:

  File "/usr/lib64/python3.5/site-packages/ldap/schema/subentry.py", line 480, in urlfetch
    ldif_parser = ldif.LDIFRecordList(ldif_file,max_entries=1)
  File "/usr/lib64/python3.5/site-packages/ldif.py", line 535, in __init__
    LDIFParser.__init__(self,input_file,ignored_attr_types,max_entries,process_url_schemes)
  File "/usr/lib64/python3.5/site-packages/ldif.py", line 294, in __init__
    self._line = self._readline()
  File "/usr/lib64/python3.5/site-packages/ldif.py", line 307, in _readline
    if s[-2:]=='\r\n':
BytesWarning: Comparison between bytes and string

which is fixed upstream in
https://github.com/pyldap/pyldap/commit/39a31ba755ff91c2f0ffa8ced713da32f6ed4cf1
which is further fixed in
https://github.com/pyldap/pyldap/commit/1b4da37305dc29a60bacb11e317bcd004400cd78
for non-standard situations.

Comment 2 Miro Hrončok 2017-05-30 09:57:31 UTC
A F26 scratch build with the latest release: https://koji.fedoraproject.org/koji/taskinfo?taskID=19780394

Let me know if that fixes it.

Also, if you wish to backport the fixes to F25, please do.

Comment 3 Standa Laznicka 2017-05-30 10:28:27 UTC
Miro,

Thank you. In the meantime, I made an own copr build for Fedora 25/26, too (I believe we're using the same sources), and found one more bytes-unicode comparison which was not yet fixed upstream and is also contained in your package.

Please, see https://github.com/pyldap/pyldap/pull/96/files, it's an easy one-liner.

Nonetheless, I could probably live with your build should we not decide to go with the ^-- PR.

Comment 4 Miro Hrončok 2017-05-30 10:39:17 UTC
Let's wait a bit for the response for the above PR.

Comment 5 Miro Hrončok 2017-05-30 10:56:58 UTC
With your patch https://koji.fedoraproject.org/koji/taskinfo?taskID=19780641

Comment 6 Miro Hrončok 2017-05-30 11:11:06 UTC
Let me know and if it works for you, I'll build it in rawhide and F26.

Comment 7 Standa Laznicka 2017-05-30 12:29:33 UTC
It does work, thanks for the brief action.

Comment 9 Fedora Update System 2017-05-30 15:59:00 UTC
python-pyldap-2.4.35.1-2.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-beaa317f1d

Comment 10 Fedora Update System 2017-06-01 03:18:25 UTC
python-pyldap-2.4.35.1-2.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-beaa317f1d

Comment 11 Fedora Update System 2017-06-09 19:16:37 UTC
python-pyldap-2.4.35.1-2.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.