public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "reg.glibc.8bngd at fraggod dot net" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/29544] New: Regression in syslog(3) calls breaks RFC due to extra whitespace
Date: Fri, 02 Sep 2022 21:45:21 +0000	[thread overview]
Message-ID: <bug-29544-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29544

            Bug ID: 29544
           Summary: Regression in syslog(3) calls breaks RFC due to extra
                    whitespace
           Product: glibc
           Version: 2.36
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: reg.glibc.8bngd at fraggod dot net
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Updating glibc from 2.35 to 2.36 introduced extra whitespace character into
messages formatted and sent through syslog()/vsyslog() calls, which seem to
break RFC and at least one common syslogd implementation (rsyslog).

For example, given following code in syslog.c file:

  #include <syslog.h>
  int main(int argc, char **argv) {
    openlog("test", LOG_PID, LOG_LOCAL0);
    syslog(LOG_ERR, "test");
    return 0;
  }

And then running it like this:

  gcc -o syslog syslog.c && strace -e sendto ./syslog

Should produce the following line (expected behavior, RFC, glibc-2.35):

  sendto(3, "<131>Sep  3 02:32:14 test[81843"...

But instead, it produces this line (actual behavior, glibc-2.36):

  sendto(3, "<131>Sep  3 02:32:14  test[81843"...

Difference is a single whitespace character inserted after timestamp, which
breaks parser in e.g. rsyslog daemon, and was confirmed by its author to be
incorrect output, not conforming to RFC (in the comment here -
https://github.com/rsyslog/rsyslog/issues/4979#issuecomment-1235380700 ).

Behavior seem to be consistent between apps using syslog() and vsyslog() calls,
and seem to be a regression in glibc-2.36 release.
glibc-2.35 and earlier versions appear to be working correctly, producing
output without that extra space in an otherwise exactly same VM.

Given recent rewrite in misc/syslog.c here, guess it might be a simple bug that
managed to slip through the cracks.

Related bug reports (with some degree of initial misattribution on my part):
- rsyslog - https://github.com/rsyslog/rsyslog/issues/4979
- systemd - https://github.com/systemd/systemd/issues/24540
- Arch Linux - https://bugs.archlinux.org/task/75776

Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-09-02 21:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 21:45 reg.glibc.8bngd at fraggod dot net [this message]
2022-09-02 21:46 ` [Bug libc/29544] " reg.glibc.8bngd at fraggod dot net
2022-09-05 12:32 ` adhemerval.zanella at linaro dot org
2022-09-05 12:47 ` adhemerval.zanella at linaro dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29544-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).