From taob@cabal.io.org  Thu May 23 16:55:33 1996
Received: from cabal.io.org (cabal.io.org [198.133.36.103])
          by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id QAA06522
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 23 May 1996 16:55:32 -0700 (PDT)
Received: (from taob@localhost) by cabal.io.org (8.7.5/8.7.3) id TAA11573; Thu, 23 May 1996 19:54:51 -0400 (EDT)
Message-Id: <199605232354.TAA11573@cabal.io.org>
Date: Thu, 23 May 1996 19:54:51 -0400 (EDT)
From: taob@io.org
Reply-To: taob@io.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: Cosmetic format error in pkg_*
X-Send-Pr-Version: 3.2

>Number:         1240
>Category:       bin
>Synopsis:       Wrong format used to print amount of free disk space
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    alex
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 23 17:00:07 PDT 1996
>Closed-Date:    Fri Jun 7 17:57:27 PDT 1996
>Last-Modified:  Fri Jun  7 17:57:54 PDT 1996
>Originator:     Brian Tao
>Release:        FreeBSD 2.2-960501-SNAP i386
>Organization:
Internex Online Inc., Toronto, Ontario, Canada
>Environment:

    Need /var/tmp filesystem with > 2GB free space and/or package
larger than 2GB uncompressed.

>Description:
	The size of the package and the amount of free disk space in
/var/tmp are size_t ints when they probably ought to be off_t ints.
At the very least, they should be unsigned.

>How-To-Repeat:
# df /var/tmp
Filesystem   1K-blocks     Used    Avail Capacity  Mounted on
/dev/sd0s1f    3476622      459  3198034     0%    /var

# pkg_add -v top-3.3.tgz 
Requested space: 86840 bytes, free space: -1020177408 bytes in /var/tmp/instmp.010105
[...]

>Fix:
    This is an incomplete fix in that filesystems with more than 4GB
of free space will produce the format error.  I tried replacing the
size_t's with off_t's, but the disk space check in find_play_pen()
would incorrectly think that (for example) 3274789888 was not greater
than 86840.  Is this a comparison bug in gcc?


*** /usr/src/usr.sbin/pkg_install/lib/pen.c	Thu May 23 19:32:41 1996
--- /usr/src/usr.sbin/pkg_install/lib/pen.c-orig	Thu May 23 19:31:51 1996
***************
*** 87,93 ****
      }
      if (Verbose) {
  	if (sz)
! 	    fprintf(stderr, "Requested space: %d bytes, free space: %u bytes in %s\n", (int)sz, min_free(pen), pen);
      }
      if (min_free(pen) < sz) {
  	rmdir(pen);
--- 87,93 ----
      }
      if (Verbose) {
  	if (sz)
! 	    fprintf(stderr, "Requested space: %d bytes, free space: %d bytes in %s\n", (int)sz, min_free(pen), pen);
      }
      if (min_free(pen) < sz) {
  	rmdir(pen);

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->alex 
Responsible-Changed-By: alex 
Responsible-Changed-When: Fri Jun 7 13:07:08 PDT 1996 
Responsible-Changed-Why:  
I have a fix prepared, just waiting for Jordan's ok. 
State-Changed-From-To: open->closed 
State-Changed-By: alex 
State-Changed-When: Fri Jun 7 17:57:27 PDT 1996 
State-Changed-Why:  
Fixed in -current and -stable. 
>Unformatted:
