Skip to content

Commit

Permalink
dnf5: Don't output to a PTY
Browse files Browse the repository at this point in the history
If DNF 5 sees an "interactive" TTY on stdout, it will try to draw
progress bars and cause the Mock logs to be garbled:
fedora-copr/copr#3040. A simple fix is to have
DNF 5 output to a pipe instead of a PTY.

I'm not sure why output is collected via a PTY from yum/dnf (seems to
start from commit 99ca2fa), but it's probably no longer needed
for DNF 5?
  • Loading branch information
evan-goode authored and praiskup committed Dec 11, 2023
1 parent 21581da commit 26e42d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mock/py/mockbuild/package_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def _execute_mounted(self, *args, **kwargs):
if not self.config['print_main_output']:
kwargs.pop('printOutput', None)
else:
kwargs['pty'] = kwargs.get('pty', True)
kwargs.setdefault("pty", True)
self.buildroot.nuke_rpm_db()

error = None
Expand Down Expand Up @@ -758,5 +758,10 @@ class Dnf5(Dnf):
"""
name = 'dnf5'
place_common_opts_after = True

def execute(self, *args, **kwargs):
kwargs.setdefault("pty", False)
return super(Dnf, self).execute(*args, **kwargs)

def update(self, *args, **_kwargs):
return self.execute('upgrade', *args)
4 changes: 4 additions & 0 deletions releng/release-notes-next/dnf5-logs-with-no-pty.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
If DNF 5 sees an "interactive" TTY on stdout, it will try to draw progress bars
and cause the Mock logs to [be garbled](https://github.com/fedora-copr/copr/issues/3040).
This release brings a fix that simply sets the output of DNF5 to a pipe instead
of a PTY.

0 comments on commit 26e42d1

Please sign in to comment.