Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 May 1996 19:54:51 -0400 (EDT)
From:      taob@io.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/1240: Cosmetic format error in pkg_*
Message-ID:  <199605232354.TAA11573@cabal.io.org>
Resent-Message-ID: <199605240000.RAA06823@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1240
>Category:       bin
>Synopsis:       Wrong format used to print amount of free disk space
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 23 17:00:07 PDT 1996
>Last-Modified:
>Originator:     Brian Tao
>Organization:
Internex Online Inc., Toronto, Ontario, Canada
>Release:        FreeBSD 2.2-960501-SNAP i386
>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);

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605232354.TAA11573>