From f91fa6460a5dc22c532040d93cfc30f2b7c3080c Mon Sep 17 00:00:00 2001 From: Linux_zhang Date: Mon, 27 Jan 2025 16:09:26 +0800 Subject: [PATCH] Fix bug related to ctrl-X when output is not a termi --- ...to-ctrl-X-when-output-is-not-a-termi.patch | 43 +++++++++++++++++++ less.spec | 6 ++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 backport-Fix-bug-related-to-ctrl-X-when-output-is-not-a-termi.patch diff --git a/backport-Fix-bug-related-to-ctrl-X-when-output-is-not-a-termi.patch b/backport-Fix-bug-related-to-ctrl-X-when-output-is-not-a-termi.patch new file mode 100644 index 0000000..4759571 --- /dev/null +++ b/backport-Fix-bug-related-to-ctrl-X-when-output-is-not-a-termi.patch @@ -0,0 +1,43 @@ +From ed454a217da417dc052723ea70da8efde0f2e66c Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Sat, 10 Aug 2024 08:11:59 -0700 +Subject: [PATCH] Fix bug related to ctrl-X when output is not a terminal. + +We should not check for ctrl-X input when the output is not +a terminal. This results in trying to poll and read input +characters from stdin instead of from the terminal. + +This problem existed in v661 so is not strictly a regression +that needs to be addressed in the upcoming bug fix release, +but because it's a low-risk fix and has potentially serious +consequences, I'm including it. + +Related to #558. +--- + os.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/os.c b/os.c +index 61c336c..9f89777 100644 +--- a/os.c ++++ b/os.c +@@ -80,6 +80,7 @@ extern int exit_F_on_close; + extern int follow_mode; + extern int scanning_eof; + extern char intr_char; ++extern int is_tty; + #if !MSDOS_COMPILER + extern int tty; + #endif +@@ -237,7 +238,7 @@ start: + } + #endif + #if USE_POLL +- if (fd != tty && use_poll) ++ if (is_tty && fd != tty && use_poll) + { + int ret = check_poll(fd, tty); + if (ret != 0) +-- +2.33.0 + diff --git a/less.spec b/less.spec index 6c861ae..daa5fb0 100644 --- a/less.spec +++ b/less.spec @@ -1,6 +1,6 @@ Name: less Version: 633 -Release: 4 +Release: 5 Summary: Less is a pager that displays text files. License: GPLv3+ or BSD URL: http://www.greenwoodsoftware.com/less @@ -14,6 +14,7 @@ Patch5: backport-Don-t-return-READ_AGAIN-from-iread-if-no-data-has-ye.pa Patch6: backport-Fix-for-previous-fix.patch Patch7: backport-Avoid-stealing-data-from-an-input-program-that-uses-.patch Patch8: backport-Do-not-assume-PATH_MAX-is-defined.patch +Patch9: backport-Fix-bug-related-to-ctrl-X-when-output-is-not-a-termi.patch BuildRequires: gcc make ncurses-devel autoconf automake libtool @@ -52,6 +53,9 @@ autoreconf -ivf %{_mandir}/man1/* %changelog +* Mon Jan 27 2025 Linux_zhang - 633-5 +- Fix bug related to ctrl-X when output is not a termi + * Fri May 10 2024 baiguo - 633-4 - Do not assume PATH_MAX is defined -- Gitee