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

2 months ago

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

a month 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)

a month ago

Metadata Update from @mreynolds:
- Issue assigned to firstyear

a month 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

a month ago

Login to comment on this ticket.

Metadata