Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Mar 2002 21:18:21 +0600 (NOVT)
From:      Dmitry Frolov <frolov@riss-telecom.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/36136: savecore -z option does not work
Message-ID:  <200203201518.g2KFILs49998@nerve.riss-telecom.ru>

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

>Number:         36136
>Category:       bin
>Synopsis:       savecore -z option does not work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 20 07:20:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Frolov
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
RISS-Telecom
>Environment:
System: FreeBSD nerve.riss-telecom.ru 4.5-STABLE FreeBSD 4.5-STABLE #0: Thu Mar 7 22:35:51 NOVT 2002 root@nerve.riss-telecom.ru:/usr/src/sys/compile/NERVE i386

>Description:

	When saving kernel core dump, savecore attempts to find blocks
of zeroes in dump, and calls fseek on output stream when
finds such block. If -z option is specified, stream is created
with zlib "zopen" function, and fseek on that stream fails.

Problem represented by commit at Feb 16 2001 (savecore.c revision 1.37).

>How-To-Repeat:

# savecore -z /var/crash
savecore: reboot after panic: page fault
savecore: system went down at Wed Mar 20 19:54:18 2002
savecore: writing compressed core to /var/crash/vmcore.0.gz
savecore: /var/crash/vmcore.0.gz: Illegal seek
savecore: WARNING: vmcore may be incomplete

>Fix:

savecore.c: Don't search for zeroes if -z option is specified.

--- sbin/savecore/savecore.c.old	Wed Mar 20 21:03:18 2002
+++ sbin/savecore/savecore.c	Wed Mar 20 21:05:05 2002
@@ -432,14 +432,17 @@
 			nw = fwrite(buf, 1, nr, fp);
 		} else {
 			for (nw = 0; nw < nr; nw = he) {
-			    /* find a contiguous block of zeroes */
-			    for (hs = nw; hs < nr; hs += BLOCKSIZE) {
-				for (he = hs; he < nr && buf[he] == 0; ++he)
-				    /* nothing */ ;
-				/* is the hole long enough to matter? */
-				if (he >= hs + BLOCKSIZE)
-				    break;
-			    }
+				if (compress)
+					hs = he = nr;
+				else
+				    /* find a contiguous block of zeroes */
+				    for (hs = nw; hs < nr; hs += BLOCKSIZE) {
+					for (he = hs; he < nr && buf[he] == 0; ++he)
+					    /* nothing */ ;
+					/* is the hole long enough to matter? */
+					if (he >= hs + BLOCKSIZE)
+					    break;
+				    }
 			
 			    /* back down to a block boundary */
 			    he &= BLOCKMASK;

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

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




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