Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Aug 2004 21:27:19 -0500
From:      "Skip Ford" <skip.ford@verizon.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/70392: NO_DYNAMICROOT + savecore -z dumps core
Message-ID:  <20040813022719.MGWH14383.out010.verizon.net@pool-70-17-33-167.pskn.east.verizon.net>
Resent-Message-ID: <200408130230.i7D2UUYg009002@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         70392
>Category:       bin
>Synopsis:       NO_DYNAMICROOT + savecore -z dumps core
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 13 02:30:30 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Skip Ford
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD lucy 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Wed Aug 11 18:44:53 EDT 2004 root@lucy:/usr/obj/src/sys/LUCY i386

>Description:
Statically linking savecore (NO_DYNAMICROOT) causes conflict:

/usr/bin/ld: Warning: size of symbol `compress' changed from 4 in savecore.o to 27 in /usr/lib/libz.a(compress.o)
/usr/bin/ld: Warning: type of symbol `compress' changed from 1 to 2 in /usr/lib/libz.a(compress.o)

'compress' is an integer in savecore.o and a function in compress.o.
The resulting binary dumps core when run with compression (-z).

>How-To-Repeat:
Statically link savecore(8) and execute 'savecore -z'.

$ ldd ./savecore
ldd: ./savecore: not a dynamic executable
$ ./savecore -z
Bus error (core dumped)

>Fix:
Not sure if the conflict is valid or a toolchain problem, but renaming
the int works around the problem.

Index: sbin/savecore/savecore.c
===================================================================
RCS file: /cvs/ncvs/src/sbin/savecore/savecore.c,v
retrieving revision 1.68
diff -u -r1.68 savecore.c
--- sbin/savecore/savecore.c	28 Feb 2004 10:42:27 -0000	1.68
+++ sbin/savecore/savecore.c	12 Aug 2004 13:14:21 -0000
@@ -88,7 +88,7 @@
 /* The size of the buffer used for I/O. */
 #define	BUFFERSIZE	(1024*1024)
 
-int checkfor, compress, clear, force, keep, verbose;	/* flags */
+int checkfor, compress_core, clear, force, keep, verbose;	/* flags */
 int nfound, nsaved, nerr;			/* statistics */
 
 extern FILE *zopen(const char *, const char *);
@@ -347,7 +347,7 @@
 		goto closefd;
 	}
 	oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/
-	if (compress) {
+	if (compress_core) {
 		sprintf(buf, "vmcore.%d.gz", bounds);
 		fp = zopen(buf, "w");
 	} else {
@@ -371,7 +371,7 @@
 	fclose(info);
 
 	syslog(LOG_NOTICE, "writing %score to %s",
-	    compress ? "compressed " : "", buf);
+	    compress_core ? "compressed " : "", buf);
 
 	while (dumpsize > 0) {
 		wl = BUFFERSIZE;
@@ -387,7 +387,7 @@
 			nerr++;
 			goto closeall;
 		}
-		if (compress) {
+		if (compress_core) {
 			nw = fwrite(buf, 1, wl, fp);
 		} else {
 			for (nw = 0; nw < nr; nw = he) {
@@ -515,7 +515,7 @@
 			force = 1;
 			break;
 		case 'z':
-			compress = 1;
+			compress_core = 1;
 			break;
 		case '?':
 		default:

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040813022719.MGWH14383.out010.verizon.net>