From deda2869b7516ba4d8001ac5f8da4833f2d89c10 Mon Sep 17 00:00:00 2001 From: buque Date: Sat, 24 Sep 2022 15:17:26 +0800 Subject: [PATCH] Subject: [PATCH] syslog: Remove extra whitespace between timestamp and message (BZ#29544) The rfc3164 clear states that a single space character must follow the timestamp field. Checked on x86_64-linux-gnu. --- ...tra-whitespace-between-timestamp-and.patch | 60 +++++++++++++++++++ glibc.spec | 6 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 0001-syslog-Remove-extra-whitespace-between-timestamp-and.patch diff --git a/0001-syslog-Remove-extra-whitespace-between-timestamp-and.patch b/0001-syslog-Remove-extra-whitespace-between-timestamp-and.patch new file mode 100644 index 0000000..a3a5034 --- /dev/null +++ b/0001-syslog-Remove-extra-whitespace-between-timestamp-and.patch @@ -0,0 +1,60 @@ +From 645d94808aaa90fb1b20a25ff70bb50d9eb1d55b Mon Sep 17 00:00:00 2001 +From: Adhemerval Zanella +Date: Mon, 5 Sep 2022 09:34:39 -0300 +Subject: [PATCH] syslog: Remove extra whitespace between timestamp and message + (BZ#29544) + +The rfc3164 clear states that a single space character must follow +the timestamp field. + +Checked on x86_64-linux-gnu. + +Signed-off-by: buque +--- + misc/syslog.c | 2 +- + misc/tst-syslog.c | 9 ++++++--- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/misc/syslog.c b/misc/syslog.c +index b88f66c835..f67d4b58a4 100644 +--- a/misc/syslog.c ++++ b/misc/syslog.c +@@ -167,7 +167,7 @@ __vsyslog_internal (int pri, const char *fmt, va_list ap, + _nl_C_locobj_ptr); + + #define SYSLOG_HEADER(__pri, __timestamp, __msgoff, pid) \ +- "<%d>%s %n%s%s%.0d%s: ", \ ++ "<%d>%s%n%s%s%.0d%s: ", \ + __pri, __timestamp, __msgoff, \ + LogTag == NULL ? __progname : LogTag, \ + "[" + (pid == 0), pid, "]" + (pid == 0) +diff --git a/misc/tst-syslog.c b/misc/tst-syslog.c +index 1d332ece53..3560b518a2 100644 +--- a/misc/tst-syslog.c ++++ b/misc/tst-syslog.c +@@ -275,16 +275,19 @@ parse_syslog_msg (const char *msg) + { + struct msg_t r = { .pid = -1 }; + int number; ++ int wsb, wsa; + + #define STRINPUT(size) XSTRINPUT(size) + #define XSTRINPUT(size) "%" # size "s" + + /* The message in the form: +- <179>Apr 8 14:51:19 tst-syslog: message 176 3 */ +- int n = sscanf (msg, "<%3d>%*s %*d %*d:%*d:%*d " STRINPUT(IDENT_LENGTH) ++ <179>Apr 8 14:51:19 tst-syslog: message 176 3 */ ++ int n = sscanf (msg, "<%3d>%*s %*d %*d:%*d:%*d%n %n" STRINPUT(IDENT_LENGTH) + " " STRINPUT(MSG_LENGTH) " %*d %*d", +- &number, r.ident, r.msg); ++ &number, &wsb, &wsa, r.ident, r.msg); + TEST_COMPARE (n, 3); ++ /* It should only one space between timestamp and message. */ ++ TEST_COMPARE (wsa - wsb, 1); + + r.facility = number & LOG_FACMASK; + r.priority = number & LOG_PRIMASK; +-- +2.37.3.windows.1 + diff --git a/glibc.spec b/glibc.spec index 16f0030..e3a6153 100644 --- a/glibc.spec +++ b/glibc.spec @@ -65,7 +65,7 @@ ############################################################################## Name: glibc Version: 2.36 -Release: 9 +Release: 10 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -90,6 +90,7 @@ Patch3: Linux-Fix-enum-fsconfig_command-detection-in-sys-mou.patch Patch4: syslog-Fix-large-messages-BZ-29536.patch Patch5: Linux-Do-not-skip-d_ino-0-entries-in-readdir-readdir.patch Patch6: 0001-gconv-Use-64-bit-interfaces-in-gconv_parseconfdir-bu.patch +Patch7: 0001-syslog-Remove-extra-whitespace-between-timestamp-and.patch Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch Patch9001: locale-delete-no-hard-link-to-avoid-all_language-pac.patch @@ -1265,6 +1266,9 @@ fi %endif %changelog +* Sat Sep 24 2022 Xu Wu - 2.36-10 +- syslog: Fix large messages (BZ#29536) + * Fri Sep 23 2022 Xu Wu - 2.36-9 - gconv: Use 64-bit interfaces in gconv_parseconfdir (bug 29583)