Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2002 07:50:06 -0700 (PDT)
From:      Peter Pentchev <roam@ringlet.net>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: misc/38857: "file" command hangs when using "-z" option with very little compressed files
Message-ID:  <200206051450.g55Eo6l90096@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/38857; it has been noted by GNATS.

From: Peter Pentchev <roam@ringlet.net>
To: Miguel Angel Vicente Serrano <unixroot@teleline.es>
Cc: bug-followup@FreeBSD.org
Subject: Re: misc/38857: "file" command hangs when using "-z" option with very little compressed files
Date: Wed, 5 Jun 2002 14:29:30 +0300

 On Mon, Jun 03, 2002 at 07:36:17AM -0700, Miguel Angel Vicente Serrano wrote:
 > 
 > >Number:         38857
 > >Category:       misc
 > >Synopsis:       "file" command hangs when using "-z" option with very little compressed files
 > >Originator:     Miguel Angel Vicente Serrano
 > >Environment:
 > 4.5 RELEASE
 > >Description:
 > I compress a very little file using gzip with those commands:
 > echo aaaa > little ; gzip -9v little
 > The result is little.gz and when I use the command:
 > file -z little.gz
 > the process hangs, using almosr 99% of cpu, as shown on "top" command
 > >How-To-Repeat:
 > echo aaaa > little
 > gzip -9v little
 > file -z little.gz     ======> process hangs
 > >Fix:
 > to fix:
 > 
 > gzcat little.gz | file -
 
 Attached is a patch that fixes this problem; it is made against the
 sources in the FreeBSD 5.0-CURRENT branch, but it applies cleanly
 against both 4.5-RELEASE and 4.6-RC (today's -STABLE).
 
 A note to David O'Brien, the maintainer of FreeBSD's file(1):
 This patch is actually taken from Christos Zoulas's file-3.38; that is,
 it may safely be vendor-imported, and the vendor impotr of the next
 file(1) release will incorporate it with no problems.  I took the time
 to check Christos's new versions right after I had come up with the
 exact same fix for this issue :)
 
 G'luck,
 Peter
 
 -- 
 Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 This sentence claims to be an Epimenides paradox, but it is lying.
 
 Index: src/contrib/file/compress.c
 ===================================================================
 RCS file: /home/ncvs/src/contrib/file/compress.c,v
 retrieving revision 1.1.1.3
 diff -u -r1.1.1.3 compress.c
 --- src/contrib/file/compress.c	30 Jul 2001 03:09:43 -0000	1.1.1.3
 +++ src/contrib/file/compress.c	5 Jun 2002 11:24:54 -0000
 @@ -120,6 +120,8 @@
  			if (errno == EINTR)
  				continue;
  			return -1;
 +		case 0:
 +			return rn - n;
  		default:
  			n -= rv;
  			buf = ((char *)buf) + rv;

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?200206051450.g55Eo6l90096>