Skip to content

Commit 0fe4de3

Browse files
committed
libutil: stdlog: allow non-ascii characters
Problem: As a preventative measure when log message contents were wrapped into a JSON payload during log.dmesg responses, the stdlog_encode() implementation clears all bits that are not valid ASCII in log messages. This means, for example, that the F58 jobid prefix is garbled in log messages, along with any other non-ASCII characters. Since `log.dmesg` responses no longer use JSON, requiring ASCII-only log message contents is not strictly necessary. Therefore, remove the code that cleared non-ASCII bits. Note: Technically, RFC 5424 requires that a BOM (byte order mask) be placed before all known UTF-8 message content. However, the RFC does allow conformant implementations to skip the BOM if the content is not known to be UTF-8. Therefore, this implementation avoids encoding the BOM on messages since it cannot know with certainty all messages are valid UTF-8 without scanning every byte (which is not done). The BOM would be unused in the implementation anyway, and currently Flux log messages are not forwarded to other syslog implementations, so there would be little gain in encoding this sentinel anyway. Fixes #5250
1 parent 6bf876d commit 0fe4de3

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

src/common/libutil/stdlog.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ int stdlog_vencodef (char *buf, int len, struct stdlog_header *hdr,
180180
rc += n;
181181
if (n > len - m)
182182
n = len - m;
183-
for (i = 0; i < n; i++)
184-
buf[m + i] &= 0x7f; // ensure only ascii chars are logged
185183
for (i = n - 1; i >= 0; i--) {
186184
if (buf[m + i] != '\r' && buf[m + i] != '\n')
187185
break;

0 commit comments

Comments
 (0)