#50798 Installation with python3-lib389 lib produces msg "BytesWarning: str() on a bytes instance"
Closed: wontfix by mreynolds. Opened 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

https://pagure.io/389-ds-base/pull-request/50801

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

commit c39c7bbca984922dc8c9f33add65a5f5662fcba4

32c1505be..cec2cb3cf 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)

Metadata Update from @mreynolds:
- Issue assigned to firstyear

Commit 828aad07 relates to this ticket

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

Commit 828aad0 relates to this ticket

e84bbce3f..ad4d3dfff 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

Issue linked to Bugzilla: Bug 1791095

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)

Metadata