From owner-freebsd-bugs Tue Oct 1 14: 0:19 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5F7E337B401 for ; Tue, 1 Oct 2002 14:00:17 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id F23EE43E6A for ; Tue, 1 Oct 2002 14:00:16 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g91L0GCo087825 for ; Tue, 1 Oct 2002 14:00:16 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g91L0G55087824; Tue, 1 Oct 2002 14:00:16 -0700 (PDT) Date: Tue, 1 Oct 2002 14:00:16 -0700 (PDT) Message-Id: <200210012100.g91L0G55087824@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: bin/43434: New option to 'dmesg' which allow to display or not old boot messages Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/43434; it has been noted by GNATS. From: Bruce Evans To: Brooks Davis Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: bin/43434: New option to 'dmesg' which allow to display or not old boot messages Date: Wed, 2 Oct 2002 06:26:15 +1000 (EST) On Tue, 1 Oct 2002, Brooks Davis wrote: > On Tue, Oct 01, 2002 at 10:10:06AM -0700, Bruce Evans wrote: > > > > What's wrong with ``grep [-C] /var/log/messages'' then? :-) > > (except it doesn't handled rotated log files or races with newsyslog ...). > > > > 99+% of the time when a user types dmesg what they really want to see is: > > Copyright (c) 1992-2002 The FreeBSD Project. > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 > The Regents of the University of California. All rights > reserved. > FreeBSD 5.0-CURRENT #2: Thu Sep 26 14:33:02 PDT 2002 > root@minya.sea.one-eyed-alien.net:/usr/obj/usr/src/sys/GENERIC > Preloaded elf kernel "/boot/kernel/kernel" at 0xc06ca000. > Preloaded elf module "/boot/kernel/snd_maestro3.ko" at 0xc06ca0a8. > ... > > For the _current_ boot. They couldn't care less about previous boots > unless they are looking for a message to diagnose a crash. Currently if > you don't have extra debugging stuff on and you don't generate a lot of > errors, you typicaly find boot messages repeated several times, especialy > in -stable. Thus you have to carefully scroll though the whole list to > find the current boot. This change makes dmesg do what the user wants, > but allows access to the previous messages in the unlikely event they > are needed. I see. The description in the PR is confusing -- it says that the last boot message is wanted, but actually the messages from the current boot are wanted. I think grep or an editor search is enough to find the start of the buffer. This can be automated, preferably not by hacking on dmesg, but I wouldn't mind adding a tag that is easy to search for and likely to be unique for each boot. The implementation has a buffer overrun in subr_prf.c (when msg_bufx is near the end of the buffer at init time) and some style bugs. Any tag should be written using an ordinary printf. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message