Your message dated Thu, 2 Mar 2023 22:43:34 +0100
with message-id <20230302214334.lxwr2q6egz5nj...@zeha.at>
and subject line Re: unblock: util-linux/2.38.1-5
has caused the Debian Bug report #1031212,
regarding unblock: util-linux/2.38.1-5
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
1031212: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1031212
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock package util-linux, to fix a bug in logger(1).

[ Reason ]
Bug #1030285 reports that logger(1) does not update the syslog header
information for each line received on stdin. A similar report went
upstream a longer time ago and upstream fixed this, but did not make a
release yet.

[ Impact ]
logger(1) would report incorrect timestamps for common `stuff | logger`
usecases.

[ Tests ]
Manual test succeeded.

[ Risks ]
Patch is from upstream and can be trivially tested.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing

As the debdiff will be a diff of a diff, here is the "first layer of
diff":
https://salsa.debian.org/debian/util-linux/-/commit/82443e63149b2da9a4b226e01fa07429955ea052#c428a8aed70931706a24001ebaee2aaa216085e2

unblock util-linux/2.38.1-5
diff -Nru util-linux-2.38.1/debian/changelog util-linux-2.38.1/debian/changelog
--- util-linux-2.38.1/debian/changelog  2022-11-25 15:19:08.000000000 +0000
+++ util-linux-2.38.1/debian/changelog  2023-02-13 08:48:21.000000000 +0000
@@ -1,3 +1,9 @@
+util-linux (2.38.1-5) unstable; urgency=medium
+
+  * Apply upstream patch to fix logger timestamp for stdin (Closes: #1030285)
+
+ -- Chris Hofstaedtler <z...@debian.org>  Mon, 13 Feb 2023 08:48:21 +0000
+
 util-linux (2.38.1-4) unstable; urgency=medium
 
   [ Helmut Grohne ]
diff -Nru util-linux-2.38.1/debian/patches/series 
util-linux-2.38.1/debian/patches/series
--- util-linux-2.38.1/debian/patches/series     2022-11-25 15:19:08.000000000 
+0000
+++ util-linux-2.38.1/debian/patches/series     2023-02-13 08:48:21.000000000 
+0000
@@ -34,3 +34,4 @@
 upstream/PATCH-1-2-lib-pty-Put-master-PTY-into-non-blocking-mode-a.patch
 upstream/PATCH-2-2-lib-pty-minor-cleanups.patch
 upstream/PATCH-script-abort-if-unused-arguments-are-given.patch
+upstream/logger-always-update-header-when-read-from-stdin.patch
diff -Nru 
util-linux-2.38.1/debian/patches/upstream/logger-always-update-header-when-read-from-stdin.patch
 
util-linux-2.38.1/debian/patches/upstream/logger-always-update-header-when-read-from-stdin.patch
--- 
util-linux-2.38.1/debian/patches/upstream/logger-always-update-header-when-read-from-stdin.patch
    1970-01-01 00:00:00.000000000 +0000
+++ 
util-linux-2.38.1/debian/patches/upstream/logger-always-update-header-when-read-from-stdin.patch
    2023-02-13 08:48:21.000000000 +0000
@@ -0,0 +1,94 @@
+From: Karel Zak <k...@redhat.com>
+Date: Tue, 1 Nov 2022 10:30:06 +0100
+Subject: 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 <k...@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 bec684f..e2b0b41 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;
+ }

--- End Message ---
--- Begin Message ---
2.38.1-5 has migrated to testing a few days ago.

Chris

--- End Message ---

Reply via email to