From swear@blarg.net  Sat Mar  9 21:54:18 2002
Return-Path: <swear@blarg.net>
Received: from lists.blarg.net (lists.blarg.net [206.124.128.17])
	by hub.freebsd.org (Postfix) with ESMTP id C65AD37B400
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  9 Mar 2002 21:54:17 -0800 (PST)
Received: from thig.blarg.net (thig.blarg.net [206.124.128.18])
	by lists.blarg.net (Postfix) with ESMTP id 86161BD30
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  9 Mar 2002 21:54:17 -0800 (PST)
Received: from localhost.localdomain ([206.124.139.115])
	by thig.blarg.net (8.9.3/8.9.3) with ESMTP id VAA09147
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 9 Mar 2002 21:54:17 -0800
Received: (from jojo@localhost)
	by localhost.localdomain (8.11.6/8.11.3) id g2A5vev04253;
	Sat, 9 Mar 2002 21:57:40 -0800 (PST)
	(envelope-from swear@blarg.net)
Message-Id: <jp4rjpdkx7.rjp@localhost.localdomain>
Date: 09 Mar 2002 21:57:40 -0800
From: "Gary W. Swearingen" <swear@blarg.net>
Reply-To: swear@blarg.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: /etc/rc should create missing "dumpdir".
X-GNATS-Notify:

>Number:         35725
>Category:       conf
>Synopsis:       /etc/rc should create missing "dumpdir".
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    cjc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 09 22:00:01 PST 2002
>Closed-Date:    Sun Mar 17 01:53:27 PST 2002
>Last-Modified:  Sun Mar 17 01:53:27 PST 2002
>Originator:     Gary W. Swearingen
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
none
>Environment:
n/a
================
>Description:

It is easy for one to follow the FAQ and man pages to configure for
crash dumps and fail to get the dump captured because the user didn't
know that the "dumpdir" needed to be pre-made, not just named in the
rc.config file.  I admit that it could be considered to be an implicit
requirement, but many will not think of it without a warning.

A good (?) and simple enhancement would be to have the code in /etc/rc
which checks for a missing "dumpdir" create it after it determines that
it is missing.  Or maybe the savecore(8) program should create the
directory that it is told to use (and the check removed from /etc/rc).
(I don't know if there's a conventional way for programs to handle
this situation.)

In any case, the savecore(8) man page and FAQ should describe the
requirement or lack thereof for the savecore(8) and the config
procedure, respectively.

P.S. I was lucky enough to have thought of the problem while examining
/etc/rc during crash-dump configuration.  I'm sure that many others will
not be so lucky; hence this change-request.
================
>How-To-Repeat:
n/a
================
>Fix:
?
>Release-Note:
>Audit-Trail:

From: "Crist J. Clark" <cjc@FreeBSD.ORG>
To: "Gary W. Swearingen" <swear@blarg.net>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: conf/35725: /etc/rc should create missing "dumpdir".
Date: Sun, 10 Mar 2002 14:07:51 -0800

 On Sat, Mar 09, 2002 at 09:57:40PM -0800, Gary W. Swearingen wrote:
 [snip]
 
 > A good (?) and simple enhancement would be to have the code in /etc/rc
 > which checks for a missing "dumpdir" create it after it determines that
 > it is missing.
 
 I don't think that is a good idea (what if $dumpdev was fat fingered
 someplace is shouldn't be and say, filled up your root
 filesystem). However, it currently fails silently, which I don't think
 is good either. How about have rc(8) bitch about it,
 
 Index: etc/rc
 ===================================================================
 RCS file: /export/freebsd/ncvs/src/etc/rc,v
 retrieving revision 1.296
 diff -u -r1.296 rc
 --- etc/rc	17 Feb 2002 22:19:14 -0000	1.296
 +++ etc/rc	10 Mar 2002 22:02:56 -0000
 @@ -554,10 +554,14 @@
  		;;
  	esac
  
 -	if [ -e "${dumpdev}" -a -d "${dumpdir}" ]; then
 +	if [ -e "${dumpdev}" ]; then
  		/sbin/dumpon -v ${dumpdev}
 -		echo -n 'Checking for core dump: '
 -		/sbin/savecore ${savecore_flags} "${dumpdir}"
 +		if [ -d "${dumpdir}" ]; then
 +			echo -n 'Checking for core dump: '
 +			/sbin/savecore ${savecore_flags} "${dumpdir}"
 +		else
 +			echo "dumpdir directory does not exist: ${dumpdir}"
 +		fi
  	fi
  	;;
  esac
 
 -- 
 Crist J. Clark                     |     cjclark@alum.mit.edu
                                    |     cjclark@jhu.edu
 http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

From: swear@blarg.net (Gary W. Swearingen)
To: "Crist J. Clark" <cjc@FreeBSD.ORG>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: conf/35725: /etc/rc should create missing "dumpdir".
Date: 10 Mar 2002 15:00:19 -0800

 "Crist J. Clark" <cjc@FreeBSD.ORG> writes:
 
 > I don't think that is a good idea (what if $dumpdev was fat fingered
 > someplace is shouldn't be and say, filled up your root
 > filesystem). However, it currently fails silently, which I don't think
 > is good either. How about have rc(8) bitch about it,
 
 Sounds like you speak from experience.  I'll not argue with that.
 
 We'll need to rely mostly on a good warning in the FAQ and man page(s).
 Unless you educate me that I've got the PR SOP wrong, I'll write another
 PR on the docs and leave this PR for your change to "/etc/rc".
 
 Your patch looked good, except I'd prefer a stronger notice (of what
 happened) to the person recovering from this intermittent crash he's
 been awaiting for several days:
 
 echo "NOTICE: Core dump was lost because '${dumpdir}' was not a directory."
 
 But I guess he'll figure it out after not finding the dump files, so
 either message provides a clue that should be good enough to let him
 know it wasn't the software's fault that the files are missing.

From: "Crist J. Clark" <crist.clark@attbi.com>
To: "Gary W. Swearingen" <swear@blarg.net>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: conf/35725: /etc/rc should create missing "dumpdir".
Date: Sun, 10 Mar 2002 15:32:10 -0800

 On Sun, Mar 10, 2002 at 03:00:19PM -0800, Gary W. Swearingen wrote:
 > "Crist J. Clark" <cjc@FreeBSD.ORG> writes:
 > 
 > > I don't think that is a good idea (what if $dumpdev was fat fingered
 > > someplace is shouldn't be and say, filled up your root
 > > filesystem). However, it currently fails silently, which I don't think
 > > is good either. How about have rc(8) bitch about it,
 > 
 > Sounds like you speak from experience.  I'll not argue with that.
 > 
 > We'll need to rely mostly on a good warning in the FAQ and man page(s).
 > Unless you educate me that I've got the PR SOP wrong, I'll write another
 > PR on the docs and leave this PR for your change to "/etc/rc".
 > 
 > Your patch looked good, except I'd prefer a stronger notice (of what
 > happened) to the person recovering from this intermittent crash he's
 > been awaiting for several days:
 > 
 > echo "NOTICE: Core dump was lost because '${dumpdir}' was not a directory."
 
 But we don't know if a dump was lost or not. You'd see the error
 everytime you booted. I'll word it more strongly, and I think perhaps
 another check may be in order.
 -- 
 Crist J. Clark                     |     cjclark@alum.mit.edu
                                    |     cjclark@jhu.edu
 http://people.freebsd.org/~cjc/    |     cjc@freebsd.org
State-Changed-From-To: open->analyzed 
State-Changed-By: cjc 
State-Changed-When: Mon Mar 11 00:49:03 PST 2002 
State-Changed-Why:  
Why have /etc/rc check at all? Let savecore(8) run. It will complain 
loudly if given a bummer argument and behaves well. But provide a way 
to not have savecore(8) run when dumpdev is enabled. Committed to 
-CURRENT. 


Responsible-Changed-From-To: freebsd-bugs->cjc 
Responsible-Changed-By: cjc 
Responsible-Changed-When: Mon Mar 11 00:49:03 PST 2002 
Responsible-Changed-Why:  
I'll handle MFC. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=35725 
State-Changed-From-To: analyzed->closed 
State-Changed-By: cjc 
State-Changed-When: Sun Mar 17 01:52:56 PST 2002 
State-Changed-Why:  
MFC'ed to -STABLE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35725 
>Unformatted:
