From owner-freebsd-bugs@FreeBSD.ORG Fri Oct 6 05:00:44 2006 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 [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AAA1B16A403 for ; Fri, 6 Oct 2006 05:00:44 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E13C543D46 for ; Fri, 6 Oct 2006 05:00:43 +0000 (GMT) (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 k9650hvh061592 for ; Fri, 6 Oct 2006 05:00:43 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k9650h5p061589; Fri, 6 Oct 2006 05:00:43 GMT (envelope-from gnats) Resent-Date: Fri, 6 Oct 2006 05:00:43 GMT Resent-Message-Id: <200610060500.k9650h5p061589@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, Geoffrey Giesemann Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 24A9F16A403 for ; Fri, 6 Oct 2006 04:51:35 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5A3D43D45 for ; Fri, 6 Oct 2006 04:51:34 +0000 (GMT) (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 k964pYLp004622 for ; Fri, 6 Oct 2006 04:51:34 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k964pYEM004621; Fri, 6 Oct 2006 04:51:34 GMT (envelope-from nobody) Message-Id: <200610060451.k964pYEM004621@www.freebsd.org> Date: Fri, 6 Oct 2006 04:51:34 GMT From: Geoffrey Giesemann To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: bin/104039: [patch] cp's SIGINFO handler percent complete status wraps around when the bytes copied exceeds size_t 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: Fri, 06 Oct 2006 05:00:44 -0000 >Number: 104039 >Category: bin >Synopsis: [patch] cp's SIGINFO handler percent complete status wraps around when the bytes copied exceeds size_t >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: Fri Oct 06 05:00:38 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Geoffrey Giesemann >Release: 6.2-PRERELEASE >Organization: >Environment: FreeBSD geoff.cs.rmit.edu.au 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #10: Thu Oct 5 14:44:56 EST 2006 root@geoff.cs.rmit.edu.au:/usr/obj/usr/src/sys/GEOFF i386 >Description: cp keeps a running total of the bytes copied, so that when it gets a SIGINFO it can print a percentage copied. The variable is of type size_t, so when bytes copied exceeds 4GB, it wraps to a negative value. Changing the type to off_t fixes this. >How-To-Repeat: dd if=/dev/zero of=/somewhere/with/lotsa/space/file bs=512 count=10M cp /somewhere/with/lotsa/space/file /somewhere/with/lotsa/space/file2 >Fix: Change type of wtotal to off_t: --- /usr/src/bin/cp/utils_old.c Fri Oct 6 14:05:34 2006 +++ /usr/src/bin/cp/utils.c Fri Oct 6 14:25:19 2006 @@ -64,7 +64,7 @@ int ch, checkch, from_fd = 0, rcount, rval, to_fd = 0; ssize_t wcount; size_t wresid; - size_t wtotal; + off_t wtotal; char *bufp; #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED char *p; >Release-Note: >Audit-Trail: >Unformatted: