From owner-freebsd-bugs@FreeBSD.ORG Thu Jan 11 14:20:14 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CBB216A417 for ; Thu, 11 Jan 2007 14:20:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 46D7D13C45D for ; Thu, 11 Jan 2007 14:20:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l0BEKE27093922 for ; Thu, 11 Jan 2007 14:20:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l0BEKEKP093921; Thu, 11 Jan 2007 14:20:14 GMT (envelope-from gnats) Resent-Date: Thu, 11 Jan 2007 14:20:14 GMT Resent-Message-Id: <200701111420.l0BEKEKP093921@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Brian Cornell Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC9D216A407 for ; Thu, 11 Jan 2007 14:19:04 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id CDA7313C461 for ; Thu, 11 Jan 2007 14:19:04 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l0BEJ4OO041336 for ; Thu, 11 Jan 2007 14:19:04 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id l0BEJ4e3041335; Thu, 11 Jan 2007 14:19:04 GMT (envelope-from nobody) Message-Id: <200701111419.l0BEJ4e3041335@www.freebsd.org> Date: Thu, 11 Jan 2007 14:19:04 GMT From: Brian Cornell To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: bin/107824: /usr/bin/head does not work with files over 2GB. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2007 14:20:14 -0000 >Number: 107824 >Category: bin >Synopsis: /usr/bin/head does not work with files over 2GB. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jan 11 14:20:13 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Brian Cornell >Release: 6.1 Release 0 >Organization: N/A >Environment: FreeBSD basement.divergentllc.com 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7 04:42:56 UTC 2006 root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP i386 >Description: When the '-c' option in head is passed an integer greater than 2147483647 it will not stop output at requested value but will instead continue output until EOF. >How-To-Repeat: Where is a file that is larger than 2.5GB use the following syntax: head -c 2200000000 Head will output the entire file instead of the first 2.2GB. >Fix: Change byte counters in head.c from long to double types. This has been tested & works. Output of diff from release to modified source code: diff head.c head.61freebsd 64c64 < static void head_bytes(FILE *, double); --- > static void head_bytes(FILE *, size_t); 73,74c73 < int first, linecnt = -1, eval = 0; < double bytecnt = -1; --- > int first, linecnt = -1, bytecnt = -1, eval = 0; 81c80 < bytecnt = strtod(optarg, &ep); --- > bytecnt = strtol(optarg, &ep, 10); 142c141 < head_bytes(FILE *fp, double cnt) --- > head_bytes(FILE *fp, size_t cnt) 145c144 < double readlen; --- > size_t readlen; END OUTPUT. >Release-Note: >Audit-Trail: >Unformatted: