Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 2000 21:04:00 +0900
From:      Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp>
To:        steve@megahack.com, Jesse <j@lumiere.net>, Adrian Chadd <adrian@FreeBSD.org>
Cc:        Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp>
Subject:   Re: savecore snafu, dirname vs dirname()
Message-ID:  <vm4s19saq7.wl@rina.r.dl.itc.u-tokyo.ac.jp>
In-Reply-To: In your message of "Sun, 12 Nov 2000 20:56:08 -0600 (CST)" <14863.22600.507386.659982@catbert.megahack.com>
References:  <14863.22600.507386.659982@catbert.megahack.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Multipart_Wed_Nov_15_21:04:00_2000-1
Content-Type: text/plain; charset=US-ASCII

On Sun, 12 Nov 2000 20:56:08 -0600 (CST),
  Steven Farmer <steve@megahack.com> said:

Steven> Here's wierd one.  It seems to be a mixup between "char *dirname" in
Steven> savecore.c and dirname() in libc...

Steven> After today's cvsup/build/install, savecore dies during the reboot:

Steven>       pid 133 (savecore), uid 0: exited on signal 10 (core dumped)
(snip)
Steven> /usr/libexec/elf/ld: Warning: size of symbol `dirname' changed from 4 to 206 in dirname.o
Steven> /usr/libexec/elf/ld: Warning: type of symbol `dirname' changed from 1 to 2 in dirname.o


On Wed, 15 Nov 2000 03:28:21 -0800 (PST),
  Jesse <j@lumiere.net> said:

Jesse> I cvsup'd today to 4.2-BETA and did a make world and recompiled my kernel.
Jesse> Everything appears to be working fine, except for savecore.

Jesse> When savecore is run (either from rc or commandline) with a directory
Jesse> argument (required) it core dumps reporting a Bus Error.

Jesse> # savecore /var/crash
Jesse> Bus error (core dumped)

I have seen exactly the same problem in -current, which was fixed in
src/sbin/savecore/savecore.c rev 1.34. Attached is the patch to fix
the bug.


--Multipart_Wed_Nov_15_21:04:00_2000-1
Content-Type: text/plain; type=patch; charset=US-ASCII
Content-Disposition: attachment; filename="savecore.c.diff"
Content-Transfer-Encoding: 7bit

Index: savecore/savecore.c
===================================================================
RCS file: /home/ncvs/src/sbin/savecore/savecore.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- savecore/savecore.c	2000/05/09 22:20:14	1.33
+++ savecore/savecore.c	2000/09/03 07:02:00	1.34
@@ -42,7 +42,7 @@
 static char sccsid[] = "@(#)savecore.c	8.3 (Berkeley) 1/2/94";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/sbin/savecore/savecore.c,v 1.33 2000/05/09 22:20:14 ps Exp $";
+  "$FreeBSD: src/sbin/savecore/savecore.c,v 1.34 2000/09/03 07:02:00 peter Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -108,7 +108,7 @@
 int	dumpsize;			/* amount of memory dumped */
 
 char	*kernel;
-char	*dirname;			/* directory to save dumps in */
+char	*savedir;			/* directory to save dumps in */
 char	*ddname;			/* name of dump device */
 dev_t	dumpdev;			/* dump device */
 int	dumpfd;				/* read/write descriptor on char dev */
@@ -175,7 +175,7 @@
 	if (!clear) {
 		if (argc != 1 && argc != 2)
 			usage();
-		dirname = argv[0];
+		savedir = argv[0];
 	}
 	if (argc == 2)
 		kernel = argv[1];
@@ -348,7 +348,7 @@
 	 * Get the current number and update the bounds file.  Do the update
 	 * now, because may fail later and don't want to overwrite anything.
 	 */
-	(void)snprintf(path, sizeof(path), "%s/bounds", dirname);
+	(void)snprintf(path, sizeof(path), "%s/bounds", savedir);
 	if ((fp = fopen(path, "r")) == NULL)
 		goto err1;
 	if (fgets(buf, sizeof(buf), fp) == NULL) {
@@ -369,7 +369,7 @@
 	/* Create the core file. */
 	oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/
 	(void)snprintf(path, sizeof(path), "%s/vmcore.%d%s",
-	    dirname, bounds, compress ? ".Z" : "");
+	    savedir, bounds, compress ? ".Z" : "");
 	if (compress) {
 		if ((fp = zopen(path, "w", 0)) == NULL) {
 			syslog(LOG_ERR, "%s: %s", path, strerror(errno));
@@ -420,7 +420,7 @@
 	/* Copy the kernel. */
 	ifd = Open(kernel ? kernel : getbootfile(), O_RDONLY);
 	(void)snprintf(path, sizeof(path), "%s/kernel.%d%s",
-	    dirname, bounds, compress ? ".Z" : "");
+	    savedir, bounds, compress ? ".Z" : "");
 	if (compress) {
 		if ((fp = zopen(path, "w", 0)) == NULL) {
 			syslog(LOG_ERR, "%s: %s", path, strerror(errno));
@@ -541,14 +541,14 @@
 	}
 	kernelsize = st.st_blocks * S_BLKSIZE;
 
-	if (statfs(dirname, &fsbuf) < 0) {
-		syslog(LOG_ERR, "%s: %m", dirname);
+	if (statfs(savedir, &fsbuf) < 0) {
+		syslog(LOG_ERR, "%s: %m", savedir);
 		exit(1);
 	}
  	spacefree = ((off_t) fsbuf.f_bavail * fsbuf.f_bsize) / 1024;
 	totfree = ((off_t) fsbuf.f_bfree * fsbuf.f_bsize) / 1024;
 
-	(void)snprintf(path, sizeof(path), "%s/minfree", dirname);
+	(void)snprintf(path, sizeof(path), "%s/minfree", savedir);
 	if ((fp = fopen(path, "r")) == NULL)
 		minfree = 0;
 	else {

--Multipart_Wed_Nov_15_21:04:00_2000-1
Content-Type: text/plain; charset=US-ASCII



-- 
Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp> <tanimura@FreeBSD.org>

--Multipart_Wed_Nov_15_21:04:00_2000-1--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?vm4s19saq7.wl>