leapp-repository/SOURCES/0043-Fix-unreadable-output-in-upgrade-log.patch
eabdullin 1377bbc817 Import from CS git
(cherry picked from commit c60931c8ff)
2025-01-23 12:06:22 +02:00

49 lines
2.0 KiB
Diff

From 1a0183b1a43e42891199efed9bd0891a24224142 Mon Sep 17 00:00:00 2001
From: David Kubek <dkubek@redhat.com>
Date: Wed, 8 Jan 2025 12:05:57 +0100
Subject: [PATCH 43/53] Fix unreadable output in upgrade log
This commit resolves an issue where unwanted escape sequences (e.g.,
ANSI codes) appear in the output of certain commands like `dnf` during
upgrades.
The issue arises because, starting with version 242, `systemd-nspawn`
introduced new pseudo-TTY capabilities (see the `Input/Output Options`
section in `systemd-nspawn(1)`). As a result, commands run within
container may include these escape sequences.
To address this, pseudo-TTY support is explicitly disabled in
`systemd-nspawn` for upgrades on RHEL9 and later.
JIRA: RHEL-69829
---
repos/system_upgrade/common/libraries/mounting.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/repos/system_upgrade/common/libraries/mounting.py b/repos/system_upgrade/common/libraries/mounting.py
index a546e9d0..2eb19d31 100644
--- a/repos/system_upgrade/common/libraries/mounting.py
+++ b/repos/system_upgrade/common/libraries/mounting.py
@@ -5,7 +5,7 @@ import shutil
from collections import namedtuple
from leapp.libraries.common.config import get_all_envs
-from leapp.libraries.common.config.version import get_source_major_version
+from leapp.libraries.common.config.version import get_source_major_version, matches_source_version
from leapp.libraries.stdlib import api, CalledProcessError, run
# Using ALWAYS_BIND will crash the upgrade process if the file does not exist.
@@ -88,6 +88,9 @@ class IsolationType(object):
# in such a case, just add line into the previous solution..
# TODO: the same about --capability=all
final_cmd += ['--keep-unit', '--capability=all']
+ if matches_source_version('>= 9.0'):
+ # Disable pseudo-TTY in container
+ final_cmd += ['--pipe']
return final_cmd + ['-D', self.target] + binds + setenvs + cmd
class CHROOT(_Implementation):
--
2.47.1