Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jun 2021 20:50:11 -0400
From:      James E Keenan <jkeenan@pobox.com>
To:        freebsd-questions@freebsd.org
Subject:   Can I avoid logging a message in /var/log/messages when testing core dumps?
Message-ID:  <a98cad60-6005-1b98-213b-31997bcb9628@pobox.com>

next in thread | raw e-mail | index | archive | help
I am writing to try to understand a difference in logging behavior 
between FreeBSD on the one hand and other OSes such as Linux and OpenBSD 
on the other.

Context:  Smoke-testing of commits to the development branch of the Perl 
5 core distribution.

File:     t/op/dump.t 
(https://github.com/Perl/perl5/blob/d8ff3e95e0f2357b6f26f5a94c52c46231fb1a74/t/op/dump.t)

Problem:  When this test file is run on FreeBSD, core is dumped -- which 
is intended -- and a message is logged to /var/log/messages -- which is 
not intended.  When the test file is run on either Linux or OpenBSD, 
core is dumped but no message is logged to /var/log/messages.  This 
fills up the smoke-tester's log with messages that do not, for the 
purpose of testing, need to be logged.

Reproduce:  In one terminal, 'tail -f /var/log/messages`.  In another 
terminal, run the following program.

#####
$ cat coredump.pl
++$|;
my $pid = fork;
die "fork: $!\n" unless defined $pid;
if ($pid) {
     # parent
     waitpid($pid, 0);
}
else {
     print qq(A);
     CORE::dump foo;
     foo:
     print qq(B);
}
#####

On FreeBSD, a record like the following is added to /var/log/messages:

#####
Jun 10 00:35:18 perlmonger kernel: pid 58220 (perl), jid 0, uid 1002: 
exited on signal 6 (core dumped)
#####

Since the message is spurious from the point of view of smoke-testing, 
we would like to be able to suppress it.

Is there a FreeBSD-specific rationale for this logging?

Is there any way to suppress this log message?

Thank you very much.
Jim Keenan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a98cad60-6005-1b98-213b-31997bcb9628>