From fa152eb018b031effe96142a39608f9ff7e99254 Mon Sep 17 00:00:00 2001 From: zouzhimin Date: Mon, 29 Apr 2024 22:49:54 +0800 Subject: [PATCH] fix stdout wrapping to terminal width and modify spec file, sed command to replace patch3 with patch1 --- ...ix-stdout-wrapping-to-terminal-width.patch | 49 +++++++++++++++++++ pcs.spec | 8 ++- 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 backport-fix-stdout-wrapping-to-terminal-width.patch diff --git a/backport-fix-stdout-wrapping-to-terminal-width.patch b/backport-fix-stdout-wrapping-to-terminal-width.patch new file mode 100644 index 0000000..fcd7fa2 --- /dev/null +++ b/backport-fix-stdout-wrapping-to-terminal-width.patch @@ -0,0 +1,49 @@ +From 2f4ebe9dfb2d9854e6ae05834e6062d245dae88d Mon Sep 17 00:00:00 2001 +From: Tomas Jelinek +Date: Thu, 16 May 2024 10:36:23 +0200 +Subject: [PATCH] fix stdout wrapping to terminal width + +--- + CHANGELOG.md | 3 +++ + pcs/cli/common/output.py | 8 +++++--- + 2 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/CHANGELOG.md b/CHANGELOG.md +index a198d0f7..a6ef6cc2 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -7,9 +7,12 @@ + when not specified in `pcs cluster uidgid add` command. Empty options cause + corosync start failure. ([ghissue#772]) + - Do not allow fencing levels other than 1..9 ([RHEL-2977]) ++- Do not wrap pcs output to terminal width if pcs's stdout is redirected ++ ([RHEL-36514]) + + [ghissue#772]: https://github.com/ClusterLabs/pcs/issues/772 + [RHEL-2977]: https://issues.redhat.com/browse/RHEL-2977 ++[RHEL-36514]: https://issues.redhat.com/browse/RHEL-36514 + + + ## [0.11.7] - 2024-01-11 +diff --git a/pcs/cli/common/output.py b/pcs/cli/common/output.py +index 179f7c03..9dc0e162 100644 +--- a/pcs/cli/common/output.py ++++ b/pcs/cli/common/output.py +@@ -56,9 +56,11 @@ def format_wrap_for_terminal( + trim -- number which will be substracted from terminal size. Can be used in + cases lines will be indented later by this number of spaces. + """ +- if (sys.stdout is not None and sys.stdout.isatty()) or ( +- sys.stderr is not None and sys.stderr.isatty() +- ): ++ # This function is used for stdout only - we don't care about wrapping ++ # error messages and debug info. So it checks stdout and not stderr. ++ # Checking stderr would enable wrapping in case of 'pcs ... | grep ...' ++ # (stderr is connected to a terminal), which we don't want. (RHEL-36514) ++ if sys.stdout is not None and sys.stdout.isatty(): + return format_wrap( + text, + # minimal line length is 40 +-- +2.25.1 + diff --git a/pcs.spec b/pcs.spec index 8daffa8..e3da57d 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,6 +1,6 @@ Name: pcs Version: 0.11.7 -Release: 13 +Release: 14 License: GPL-2.0-only AND Apache-2.0 AND MIT AND BSD-3-Clause AND (BSD-2-Clause OR Ruby) AND (BSD-2-Clause OR GPL-2.0-or-later) URL: https://github.com/ClusterLabs/pcs Group: System Environment/Base @@ -46,6 +46,7 @@ Patch6: add-dtos-and-converting-functions-for-resources-stat.patch Patch7: fixes-after-review.patch Patch8: store-clone-instance-id-in-resource-status-dtos.patch Patch9: increase-a-timeout-in-a-test.patch +Patch10: backport-fix-stdout-wrapping-to-terminal-width.patch # ui patches: >200 # Patch201: bzNUMBER-01-name.patch @@ -186,7 +187,7 @@ SNMP agent that provides information about pacemaker cluster to the master agent %prep %if "%{_vendor}" != "openEuler" -sed -i 's/openEuler/%{_vendor}/g' %{PATCH3} +sed -i 's/openEuler/%{_vendor}/g' %{PATCH1} %endif # -- following is inspired by python-simplejon.el5 -- @@ -407,6 +408,9 @@ run_all_tests %license pyagentx_LICENSE.txt %changelog +* Wed May 29 2024 zouzhimin - 0.11.7-14 +- fix stdout wrapping to terminal width and modify spec file, sed command to replace "patch3" with "patch1" + * Mon May 13 2024 zouzhimin - 0.11.7-13 - fix: Support for other distributions and delete -S git from %autosetup