!95 Fix bug related to ctrl-X when output is not a termi

From: @Linux_zhang2024 
Reviewed-by: @shenyangyang01 
Signed-off-by: @shenyangyang01
This commit is contained in:
openeuler-ci-bot 2025-01-27 08:56:49 +00:00 committed by Gitee
commit 8b8b83f4aa
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From ed454a217da417dc052723ea70da8efde0f2e66c Mon Sep 17 00:00:00 2001
From: Mark Nudelman <markn@greenwoodsoftware.com>
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

View File

@ -1,6 +1,6 @@
Name: less Name: less
Version: 633 Version: 633
Release: 4 Release: 5
Summary: Less is a pager that displays text files. Summary: Less is a pager that displays text files.
License: GPLv3+ or BSD License: GPLv3+ or BSD
URL: http://www.greenwoodsoftware.com/less 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 Patch6: backport-Fix-for-previous-fix.patch
Patch7: backport-Avoid-stealing-data-from-an-input-program-that-uses-.patch Patch7: backport-Avoid-stealing-data-from-an-input-program-that-uses-.patch
Patch8: backport-Do-not-assume-PATH_MAX-is-defined.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 BuildRequires: gcc make ncurses-devel autoconf automake libtool
@ -52,6 +53,9 @@ autoreconf -ivf
%{_mandir}/man1/* %{_mandir}/man1/*
%changelog %changelog
* Mon Jan 27 2025 Linux_zhang <zhangruifang@h-partners.com> - 633-5
- Fix bug related to ctrl-X when output is not a termi
* Fri May 10 2024 baiguo <baiguo@kylinos.cn> - 633-4 * Fri May 10 2024 baiguo <baiguo@kylinos.cn> - 633-4
- Do not assume PATH_MAX is defined - Do not assume PATH_MAX is defined