COMPRESS bug? Has this happened to YOU?
Bruce D. Becker
bdb at becker.UUCP
Tue Apr 23 16:54:17 AEST 1991
In article <82 at morwyn.UUCP> forrie at morwyn.UUCP (Forrie Aldrich) writes:
|I have had, a few times, an interesting thing happen to me when using
|this newer version of compress:
|
|$Header: compress.c,v 4.0 85/07/30 12:50:00 joe Release $
|Options: BITS = 16
|
|When I am in the middle of 'zcat'ing a file, and I stop/interrupt, suddenly
|the file I was looking at disappears and is gone without a trace.
|
|Can anyone explain why this is so? I think I will revert back to the older
|version of compress that I had, as I never had problems with it.
|
|PS: I snarfed this version of compress from the gnu archives on
|prep.ai.mit.edu ...
Here's a repost of a fix for this...
--------- 8< --------- 8< --------- 8< --------- 8< --------- 8< ---------
From: stu at gtisqr.uucp (Stu Donaldson)
Newsgroups: comp.sources.bugs,comp.sources.d
Subject: Bug in compress 4.0 (zcat)
Keywords: compress
Message-ID: <1990Sep14.201714.12849 at gtisqr.uucp>
Date: 14 Sep 90 20:17:14 GMT
Followup-To: comp.sources.bugs
Organization: Maverick Microsystems International Inc, Mukilteo WA.
Lines: 80
Here is a patch to fix a bug I found in compress (zcat).
The problem would occur when trying to zcat a file that was the maximum
length filename, and didn't have the .Z stuck on the end. These files
would often be created by transferring compressed files from BSD systems
to a System V system which would truncate the name to 14 chars.
When processing the filenames, compress leaves the variable ofname with
the standard output filename format of a file.
Thus, when doing a 'zcat abc.Z', the variable ofname would be 'abc'.
This is just fine unless the input filename is 'abcdefghijklmn'
(the '.Z' truncated off is truncated on System V).
Now ofname="abcdefghijklmn" which is also the input filename.
If compress encounters an error during it's operation, or an interrupt,
it will try to unlink(ofname) which in the case described above, will
remove the file you were trying to look at.
My solution was to not unlink the output file on errors if doing a zcat.
================================================================
*** ../y/compress.c Fri Sep 14 09:41:40 1990
--- compress.c Fri Sep 14 09:23:29 1990
***************
*** 1264,1270 ****
writeerr()
{
perror ( ofname );
! unlink ( ofname );
exit ( 1 );
}
--- 1264,1270 ----
writeerr()
{
perror ( ofname );
! if (zcat_flg == 0) unlink ( ofname );
exit ( 1 );
}
***************
*** 1333,1339 ****
onintr ( )
{
! unlink ( ofname );
exit ( 1 );
}
--- 1333,1339 ----
onintr ( )
{
! if (zcat_flg == 0) unlink ( ofname );
exit ( 1 );
}
***************
*** 1341,1347 ****
{
if ( do_decomp == 1 )
fprintf ( stderr, "uncompress: corrupt input\n" );
! unlink ( ofname );
exit ( 1 );
}
--- 1341,1347 ----
{
if ( do_decomp == 1 )
fprintf ( stderr, "uncompress: corrupt input\n" );
! if (zcat_flg == 0) unlink ( ofname );
exit ( 1 );
}
--
Stu Donaldson UUCP: {smart-host}!gtisqr!stu
Maverick Microsystems ARPA: gtisqr!stu at yang.cpac.washington.edu
Mukilteo, Washington Bell: (206) 743-6659
--
,u, Bruce Becker Toronto, Ontario
a /i/ Internet: bdb at becker.UUCP, bruce at gpu.utcs.toronto.edu
`\o\-e UUCP: ...!utai!mnetor!becker!bdb
_< /_ "Waking up is hard to do" - Neil Sedated
More information about the Comp.sources.bugs
mailing list