Subject: bin/20913: gzip exits prematurely due to read error, removes source file anyway
To: None <gnats-bugs@gnats.netbsd.org>
From: Andrew Brown <atatat@atatdot.org>
List: netbsd-bugs
Date: 03/27/2003 22:46:30
>Number:         20913
>Category:       bin
>Synopsis:       gzip exits prematurely due to read error, removes source file anyway
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 27 19:47:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     TheMan
>Release:        1.6Q as of 20030325, kernel and userland
>Organization:
none
>Environment:

System: NetBSD this 1.6Q NetBSD 1.6Q (THAT) #172: Thu Mar 27 10:39:51 EST 2003  andrew@this:/usr/src/sys/arch/i386/compile/THAT i386

>Description:

my laptop panicked, which is always fun.  this time it actually
produced a dump file (sometimes it doesn't), but savecore said there
was no space and when i looked, i found two other kernel dumps that
i'd forgotten about.  i proceeded to start gzipping them, but then my
disk started throwing errors:

wd0f: error reading fsbn 790496 of 790496-0 (wd0 bn 48863024; cn 48475 tn 3 sn 35), retrying
wd0: (uncorrectable data error)
wd0f: error reading fsbn 790496 of 790496-0 (wd0 bn 48863024; cn 48475 tn 3 sn 35), retrying
wd0: (uncorrectable data error)
wd0f: error reading fsbn 790496 of 790496-0 (wd0 bn 48863024; cn 48475 tn 3 sn 35), retrying
wd0: (uncorrectable data error)
wd0: transfer error, downgrading to Ultra-DMA mode 1
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 1 (using DMA data transfers)
wd0f: error reading fsbn 790496 of 790496-0 (wd0 b
...

so i waited.  then gzip exited, and while the gzipped file was
certainly not large enough to contain the entire core (indeed running
gunzip -l indicated that there was 1/3 missing), the core file itself
was gone.

>How-To-Repeat:

start compressing a file and then get read errors.

>Fix:

not sure.  perhaps gzip should check when it thinks it's done if it
has actually read enough data to match the size of the file it was
compressing.
>Release-Note:
>Audit-Trail:
>Unformatted: