RHEL-9.5: 2.37.4-20 (more)
Related: RHEL-25559
This commit is contained in:
parent
cab1b970cc
commit
045bde2d08
96
0080-more-make-sure-we-have-data-on-stderr.patch
Normal file
96
0080-more-make-sure-we-have-data-on-stderr.patch
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
From 04e37ba1b352de91ef28f9996ca3482987a31c3a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Thu, 22 Aug 2024 08:56:52 +0200
|
||||||
|
Subject: more: make sure we have data on stderr
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
more(1) uses more_poll() to monitor data on stdin, stderr, and
|
||||||
|
signals. It is used before read_command(), but this function only
|
||||||
|
reads from stderr. Therefore, if any other non-stderr event occurs,
|
||||||
|
this function will wait on read(). In this case, more(1) will not
|
||||||
|
react to signals anymore. We need to ensure that more(1) only waits in
|
||||||
|
more_poll().
|
||||||
|
|
||||||
|
Try
|
||||||
|
|
||||||
|
for x in {1..1000}; do echo "line $x"; done | more
|
||||||
|
|
||||||
|
to reproduce.
|
||||||
|
|
||||||
|
Addresses: https://issues.redhat.com/browse/RHEL-25559
|
||||||
|
Reported-by: Radka Skvarilova <rskvaril@redhat.com>
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
text-utils/more.c | 18 +++++++++++++-----
|
||||||
|
1 file changed, 13 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/text-utils/more.c b/text-utils/more.c
|
||||||
|
index a4fbe0220..c5a060424 100644
|
||||||
|
--- a/text-utils/more.c
|
||||||
|
+++ b/text-utils/more.c
|
||||||
|
@@ -1343,7 +1343,7 @@ static void read_line(struct more_control *ctl)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* returns: 0 timeout or nothing; <0 error, >0 success */
|
||||||
|
-static int more_poll(struct more_control *ctl, int timeout)
|
||||||
|
+static int more_poll(struct more_control *ctl, int timeout, int *stderr_active)
|
||||||
|
{
|
||||||
|
enum {
|
||||||
|
POLLFD_SIGNAL = 0,
|
||||||
|
@@ -1357,6 +1357,9 @@ static int more_poll(struct more_control *ctl, int timeout)
|
||||||
|
};
|
||||||
|
int has_data = 0;
|
||||||
|
|
||||||
|
+ if (stderr_active)
|
||||||
|
+ *stderr_active = 0;
|
||||||
|
+
|
||||||
|
while (!has_data) {
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
@@ -1423,8 +1426,11 @@ static int more_poll(struct more_control *ctl, int timeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* event on stderr (we reads user commands from stderr!) */
|
||||||
|
- if (pfd[POLLFD_STDERR].revents)
|
||||||
|
+ if (pfd[POLLFD_STDERR].revents) {
|
||||||
|
has_data++;
|
||||||
|
+ if (stderr_active)
|
||||||
|
+ *stderr_active = 1;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
return has_data;
|
||||||
|
@@ -1495,7 +1501,7 @@ static void search(struct more_control *ctl, char buf[], int n)
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
- more_poll(ctl, 0);
|
||||||
|
+ more_poll(ctl, 0, NULL);
|
||||||
|
}
|
||||||
|
/* Move ctrl+c signal handling back to more_key_command(). */
|
||||||
|
signal(SIGINT, SIG_DFL);
|
||||||
|
@@ -1649,7 +1655,7 @@ static int skip_forwards(struct more_control *ctl, int nlines, cc_t comchar)
|
||||||
|
static int more_key_command(struct more_control *ctl, char *filename)
|
||||||
|
{
|
||||||
|
int retval = 0;
|
||||||
|
- int done = 0, search_again = 0;
|
||||||
|
+ int done = 0, search_again = 0, stderr_active = 0;
|
||||||
|
char cmdbuf[INIT_BUF];
|
||||||
|
struct number_command cmd;
|
||||||
|
|
||||||
|
@@ -1659,7 +1665,9 @@ static int more_key_command(struct more_control *ctl, char *filename)
|
||||||
|
ctl->report_errors = 0;
|
||||||
|
ctl->search_called = 0;
|
||||||
|
for (;;) {
|
||||||
|
- if (more_poll(ctl, -1) <= 0)
|
||||||
|
+ if (more_poll(ctl, -1, &stderr_active) <= 0)
|
||||||
|
+ continue;
|
||||||
|
+ if (stderr_active == 0)
|
||||||
|
continue;
|
||||||
|
cmd = read_command(ctl);
|
||||||
|
if (cmd.key == more_kc_unknown_command)
|
||||||
|
--
|
||||||
|
2.46.0
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
Summary: A collection of basic system utilities
|
Summary: A collection of basic system utilities
|
||||||
Name: util-linux
|
Name: util-linux
|
||||||
Version: 2.37.4
|
Version: 2.37.4
|
||||||
Release: 19%{?dist}
|
Release: 20%{?dist}
|
||||||
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
|
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
|
||||||
URL: http://en.wikipedia.org/wiki/Util-linux
|
URL: http://en.wikipedia.org/wiki/Util-linux
|
||||||
|
|
||||||
@ -227,6 +227,7 @@ Patch77: 0077-lsipc-fix-semaphore-USED-counter.patch
|
|||||||
Patch78: 0078-libblkid-Check-offset-in-LUKS2-header.patch
|
Patch78: 0078-libblkid-Check-offset-in-LUKS2-header.patch
|
||||||
# RHEL-25559 - more: fix poll() use
|
# RHEL-25559 - more: fix poll() use
|
||||||
Patch79: 0079-more-fix-poll-use.patch
|
Patch79: 0079-more-fix-poll-use.patch
|
||||||
|
Patch80: 0080-more-make-sure-we-have-data-on-stderr.patch
|
||||||
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -1062,6 +1063,9 @@ fi
|
|||||||
%{_libdir}/python*/site-packages/libmount/
|
%{_libdir}/python*/site-packages/libmount/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Aug 22 2024 Karel Zak <kzak@redhat.com> 2.37.4-20
|
||||||
|
- fix RHEL-25559 - more: make sure we have data on stderr
|
||||||
|
|
||||||
* Tue Aug 20 2024 Karel Zak <kzak@redhat.com> 2.37.4-19
|
* Tue Aug 20 2024 Karel Zak <kzak@redhat.com> 2.37.4-19
|
||||||
- fix RHEL-34165 - lsipc: fix semaphore USED counter
|
- fix RHEL-34165 - lsipc: fix semaphore USED counter
|
||||||
- fix RHEL-25265 - libblkid: Check offset in LUKS2 header
|
- fix RHEL-25265 - libblkid: Check offset in LUKS2 header
|
||||||
|
Loading…
Reference in New Issue
Block a user