Date: Tue, 03 Jan 2023 17:29:08 +1300 From: Kristof Provost <kp@FreeBSD.org> To: Eugene Grosbein <eugen@FreeBSD.org> Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: e9ae9fa93745 - main - syslog(3): unbreak log generation using fabricated PID Message-ID: <CB6BABC4-5E53-448E-A4BB-2B21CB77B018@FreeBSD.org> In-Reply-To: <202208082230.278MUYZd078396@gitrepo.freebsd.org> References: <202208082230.278MUYZd078396@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 9 Aug 2022, at 10:30, Eugene Grosbein wrote: > The branch main has been updated by eugen: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3De9ae9fa93745669b7dd0341d= 333257ad6cfe8e37 > > commit e9ae9fa93745669b7dd0341d333257ad6cfe8e37 > Author: Eugene Grosbein <eugen@FreeBSD.org> > AuthorDate: 2022-08-08 22:21:02 +0000 > Commit: Eugene Grosbein <eugen@FreeBSD.org> > CommitDate: 2022-08-08 22:21:02 +0000 > > syslog(3): unbreak log generation using fabricated PID > > Recover application ability to supply fabricated PID > embedded into ident that was lost when libc switched > to generation of RFC 5424 log messages, for example: > > logger -t "ident[$$]" -p user.notice "test" > > It is essential for long running scripts. > Also, this change unbreaks matching resulted entries > by ident in syslog.conf: > > !ident > *.* /var/log/ident.log > > Without the fix, the log (and matching) was broken: > > Aug 1 07:36:58 hostname ident[123][86483]: test > > Now it works as expected and worked before breakage: > > Aug 1 07:39:40 hostname ident[123]: test > > Differential: https://reviews.freebsd.org/D36005 > MFC after: 2 weeks > --- > lib/libc/gen/syslog.c | 54 +++++++++++++++++++++++++++++++++++++++++++= +++++--- > 1 file changed, 51 insertions(+), 3 deletions(-) > <snip> > - (void)fprintf(fp, "%d ", getpid()); > + if (LogPid =3D=3D -1) > + LogPid =3D getpid(); I believe this introduced unexpected behaviour for syslog(). If we log so= mething prior to fork()ing we=E2=80=99ll keep logging with the old pid. T= hat=E2=80=99s a fairly common pattern for daemonising code, and it=E2=80=99= s something openvpn ran into: https://github.com/OpenVPN/openvpn/issues/1= 98 Best regards, Kristof
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CB6BABC4-5E53-448E-A4BB-2B21CB77B018>