util-linux: update to 2.39.3
This commit is contained in:
parent
9944ba30ba
commit
a368008a6e
2 changed files with 3 additions and 98 deletions
|
@ -1,95 +0,0 @@
|
||||||
From 96ccdc00e1fcf1684f9734a189baf90e00ff0c9a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Karel Zak <kzak@redhat.com>
|
|
||||||
Date: Tue, 1 Nov 2022 10:30:06 +0100
|
|
||||||
Subject: [PATCH] logger: always update header when read from stdin
|
|
||||||
|
|
||||||
The current code updates the header only when the priority has been
|
|
||||||
changed. It's incorrect because wanted is a valid header or each entry
|
|
||||||
(don't forget that logger for stdin use-case is used in pipe to log
|
|
||||||
long-time running processes).
|
|
||||||
|
|
||||||
This patch also fixes the initial timestamp; it was originally generated
|
|
||||||
on logger startup, it now generates the header on the first message.
|
|
||||||
|
|
||||||
$ (sleep 2; date; sleep 2; date; sleep 2; date) | logger --stderr --no-act
|
|
||||||
|
|
||||||
old:
|
|
||||||
<13>Nov 1 10:42:14 kzak: Tue Nov 1 10:42:16 AM CET 2022
|
|
||||||
<13>Nov 1 10:42:14 kzak: Tue Nov 1 10:42:18 AM CET 2022
|
|
||||||
<13>Nov 1 10:42:14 kzak: Tue Nov 1 10:42:20 AM CET 2022
|
|
||||||
|
|
||||||
new:
|
|
||||||
<13>Nov 1 10:19:02 kzak: Tue Nov 1 10:19:02 AM CET 2022
|
|
||||||
<13>Nov 1 10:19:04 kzak: Tue Nov 1 10:19:04 AM CET 2022
|
|
||||||
<13>Nov 1 10:19:06 kzak: Tue Nov 1 10:19:06 AM CET 2022
|
|
||||||
|
|
||||||
Fixes: https://github.com/util-linux/util-linux/issues/1866
|
|
||||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
||||||
---
|
|
||||||
misc-utils/logger.c | 18 +++++++-----------
|
|
||||||
1 file changed, 7 insertions(+), 11 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/misc-utils/logger.c b/misc-utils/logger.c
|
|
||||||
index bec684f15b..e2b0b41abe 100644
|
|
||||||
--- a/misc-utils/logger.c
|
|
||||||
+++ b/misc-utils/logger.c
|
|
||||||
@@ -945,8 +945,6 @@ static void logger_open(struct logger_ctl *ctl)
|
|
||||||
ctl->tag = ctl->login = xgetlogin();
|
|
||||||
if (!ctl->tag)
|
|
||||||
ctl->tag = "<someone>";
|
|
||||||
-
|
|
||||||
- generate_syslog_header(ctl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* re-open; usually after failed connection */
|
|
||||||
@@ -996,10 +994,8 @@ static void logger_stdin(struct logger_ctl *ctl)
|
|
||||||
{
|
|
||||||
/* note: we re-generate the syslog header for each log message to
|
|
||||||
* update header timestamps and to reflect possible priority changes.
|
|
||||||
- * The initial header is generated by logger_open().
|
|
||||||
*/
|
|
||||||
int default_priority = ctl->pri;
|
|
||||||
- int last_pri = default_priority;
|
|
||||||
char *buf = xmalloc(ctl->max_message_size + 2 + 2);
|
|
||||||
int pri;
|
|
||||||
int c;
|
|
||||||
@@ -1026,10 +1022,6 @@ static void logger_stdin(struct logger_ctl *ctl)
|
|
||||||
} else
|
|
||||||
ctl->pri = default_priority;
|
|
||||||
|
|
||||||
- if (ctl->pri != last_pri) {
|
|
||||||
- generate_syslog_header(ctl);
|
|
||||||
- last_pri = ctl->pri;
|
|
||||||
- }
|
|
||||||
if (c != EOF && c != '\n')
|
|
||||||
c = getchar();
|
|
||||||
}
|
|
||||||
@@ -1040,8 +1032,10 @@ static void logger_stdin(struct logger_ctl *ctl)
|
|
||||||
}
|
|
||||||
buf[i] = '\0';
|
|
||||||
|
|
||||||
- if (i > 0 || !ctl->skip_empty_lines)
|
|
||||||
+ if (i > 0 || !ctl->skip_empty_lines) {
|
|
||||||
+ generate_syslog_header(ctl);
|
|
||||||
write_output(ctl, buf);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (c == '\n') /* discard line terminator */
|
|
||||||
c = getchar();
|
|
||||||
@@ -1317,12 +1311,14 @@ int main(int argc, char **argv)
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
logger_open(&ctl);
|
|
||||||
- if (0 < argc)
|
|
||||||
+ if (0 < argc) {
|
|
||||||
+ generate_syslog_header(&ctl);
|
|
||||||
logger_command_line(&ctl, argv);
|
|
||||||
- else
|
|
||||||
+ } else
|
|
||||||
/* Note. --file <arg> reopens stdin making the below
|
|
||||||
* function to be used for file inputs. */
|
|
||||||
logger_stdin(&ctl);
|
|
||||||
+
|
|
||||||
logger_close(&ctl);
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Template file for 'util-linux'
|
# Template file for 'util-linux'
|
||||||
# Keep this package sync with util-linux-common
|
# Keep this package sync with util-linux-common
|
||||||
pkgname=util-linux
|
pkgname=util-linux
|
||||||
version=2.38.1
|
version=2.39.3
|
||||||
revision=7
|
revision=1
|
||||||
build_style=gnu-configure
|
build_style=gnu-configure
|
||||||
configure_args="--exec-prefix=\${prefix} --enable-libuuid --disable-makeinstall-chown
|
configure_args="--exec-prefix=\${prefix} --enable-libuuid --disable-makeinstall-chown
|
||||||
--enable-libblkid --enable-fsck --disable-rpath --enable-fs-paths-extra=/usr/sbin:/usr/bin
|
--enable-libblkid --enable-fsck --disable-rpath --enable-fs-paths-extra=/usr/sbin:/usr/bin
|
||||||
|
@ -22,7 +22,7 @@ maintainer="Enno Boland <gottox@voidlinux.org>"
|
||||||
license="GPL-2.0-or-later"
|
license="GPL-2.0-or-later"
|
||||||
homepage="https://www.kernel.org/pub/linux/utils/util-linux/"
|
homepage="https://www.kernel.org/pub/linux/utils/util-linux/"
|
||||||
distfiles="${KERNEL_SITE}/utils/${pkgname}/v${version%.${version#*.*.}}/${pkgname}-${version}.tar.xz"
|
distfiles="${KERNEL_SITE}/utils/${pkgname}/v${version%.${version#*.*.}}/${pkgname}-${version}.tar.xz"
|
||||||
checksum=60492a19b44e6cf9a3ddff68325b333b8b52b6c59ce3ebd6a0ecaa4c5117e84f
|
checksum=7b6605e48d1a49f43cc4b4cfc59f313d0dd5402fa40b96810bd572e167dfed0f
|
||||||
|
|
||||||
if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
|
if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
|
||||||
makedepends+=" libxcrypt-devel"
|
makedepends+=" libxcrypt-devel"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue