With the previous patch, log messages are again written to
/var/log/dpkg.log, but they look like this (^@ represents a NUL byte):

^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@2020-03-13
08:30:12 st
atus installed gir1.2-gweather-3.0:amd64 3.36.0-1
^@.0-1
^@2.4-4
^@.4-4
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@2020-03-13
08:30:12 tr
igproc libc-bin:amd64 2.30-2 <none>
^@d64 3.36.0-1
^@.0-1
^@2.4-4
^@.4-4
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@2020-03-13
08:30:12 st
atus half-configured libc-bin:amd64 2.30-2

Reason: confusing varbuf.size and varbuf.used in log_message().
Patch attached (on top of the previous patch).

Cheers, Roderich
--- a/lib/dpkg/log.c
+++ b/lib/dpkg/log.c
@@ -40,7 +40,7 @@
 void
 log_message(const char *fmt, ...)
 {
-	static struct varbuf log;
+	static struct varbuf log = VARBUF_INIT;
 	static int logfd = -1;
 	char time_str[20];
 	time_t now;
@@ -73,7 +73,7 @@
 	varbuf_end_str(&log);
 	va_end(args);
 
-	fd_write(logfd, log.buf, log.size);
+	fd_write(logfd, log.buf, log.used);
 }
 
 struct pipef {

Reply via email to