james@bigtex.uu.net (James Van Artsdalen) (02/06/88)
There is a bug in compress.c of the standard news release. I am using news
2.11 patchlevel 14.
On a USG system, if zcat is asked to uncompress a file whose name is exactly
fourteen characters and whose name does not end in ".Z", zcat will silently
erase that input file under a couple of conditions. For example, the command:
$ zcat abcdefghijklmn >out
will delete the input file if zcat is interrupted or there is an error in
writing the output. There are a couple of other failure modes involving
similarly constructed file names, but these are normally not silent: use
the -F flag at your own risk.
The *unofficial* patch below will prevent zcat from silently removing the input
file.
-----
*** /usr/src/news/src/compress.c Sat Dec 19 14:01:59 1987
--- compress.c Fri Feb 5 14:44:22 1988
***************
*** 1185,1191
writeerr()
{
perror ( ofname );
! unlink ( ofname );
exit ( 1 );
}
--- 1185,1192 -----
writeerr()
{
perror ( ofname );
! if (zcat_flg == 0)
! unlink ( ofname );
exit ( 1 );
}
***************
*** 1254,1260
onintr ( )
{
! unlink ( ofname );
exit ( 1 );
}
--- 1255,1262 -----
onintr ( )
{
! if (zcat_flg == 0)
! unlink ( ofname );
exit ( 1 );
}
***************
*** 1262,1268
{
if ( do_decomp == 1 )
fprintf ( stderr, "uncompress: corrupt input\n" );
! unlink ( ofname );
exit ( 1 );
}
--- 1264,1271 -----
{
if ( do_decomp == 1 )
fprintf ( stderr, "uncompress: corrupt input\n" );
! if (zcat_flg == 0)
! unlink ( ofname );
exit ( 1 );
}
--
James R. Van Artsdalen ...!uunet!utastro!bigtex!james "Live Free or Die"
Work: 512-328-0282 Home: 346-2444; 110 Wild Basin Rd. Ste #230, Austin TX 78746