#50798 Installation with python3-lib389 lib produces msg "BytesWarning: str() on a bytes instance"
Closed: wontfix 4 years ago by mreynolds. Opened 4 years ago by frenaud.

Issue Description

When installing FreeIPA server on fedora 31 with the python library, the following message is displayed:

...
  [1/44]: creating directory server instance
/usr/lib/python3.7/site-packages/lib389/instance/setup.py:786: BytesWarning: str() on a bytes instance
  self.log.debug(f"CMD: {' '.join(result.args)} ; STDOUT: {result.stdout} ; STDERR: {result.stderr}")
  [2/44]: configure autobind for root
...

Uninstallation also produces the same type of message:

...
Unconfiguring directory server
/usr/lib/python3.7/site-packages/lib389/instance/remove.py:105: BytesWarning: str() on a bytes instance
  _log.debug(f"CMD: {' '.join(result.args)} ; STDOUT: {result.stdout} ; STDERR: {result.stderr}")
Unconfiguring ipa-custodia

...

Package Version and Platform

389-ds-base-1.4.2.5-3.fc31.x86_64
freeipa-server-4.9.0.dev201912201432+git-0.fc31.x86_64 (from copr @freeipa/freeipa-master-nightly)

Steps to reproduce

  1. ipa-server-install --domain $DOMAIN --realm $REALM -a Secret123 -p Secret123 -U
  2. ipa-server-install --uninstall -U

Proposed fix

In the file lib389/instance/setup.py, the line 786:

            self.log.debug(f"CMD: {' '.join(result.args)} ; STDOUT: {result.stdout} ; STDERR: {result.stderr}")

should use result.stdout.decode('utf-8') and result.stderr.decode('utf-8')

In the file lib389/instance/remove.py the line 105:

        _log.debug(f"CMD: {' '.join(result.args)} ; STDOUT: {result.stdout.decode()} ; STDERR: {result.stderr.decode()}")

should use result.stdout.decode('utf-8') and result.stderr.decode('utf-8')


Indeed, this is correct @frenaud, good spotting. We have wrappers for the decoding that should have been used for the py2 <-> py3 interop. I'll put in a pr to resolve this shortly.

Metadata Update from @firstyear:
- Custom field origin adjusted to None
- Custom field reviewstatus adjusted to None

4 years ago

Metadata Update from @mreynolds:
- Issue set to the milestone: 1.4.2

4 years ago

commit c39c7bb

32c1505..cec2cb3 389-ds-base-1.4.2 -> 389-ds-base-1.4.2

Metadata Update from @mreynolds:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

4 years ago

Metadata Update from @mreynolds:
- Issue assigned to firstyear

4 years ago

Commit 828aad0 relates to this ticket

Setup.py and remove.py were missing the ensure_list_str() import.

Commit 828aad0 relates to this ticket

e84bbce..ad4d3df 389-ds-base-1.4.2 -> 389-ds-base-1.4.2

Metadata Update from @mreynolds:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1791095

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/3852

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: fixed)

3 years ago

Login to comment on this ticket.

Metadata