From owner-freebsd-bugs Wed Jun 5 7:50:20 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2046637B401 for ; Wed, 5 Jun 2002 07:50:06 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g55Eo6l90096; Wed, 5 Jun 2002 07:50:06 -0700 (PDT) (envelope-from gnats) Date: Wed, 5 Jun 2002 07:50:06 -0700 (PDT) Message-Id: <200206051450.g55Eo6l90096@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Peter Pentchev Subject: Re: misc/38857: "file" command hangs when using "-z" option with very little compressed files Reply-To: Peter Pentchev Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR misc/38857; it has been noted by GNATS. From: Peter Pentchev To: Miguel Angel Vicente Serrano 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