Subject: pkgtools/pkg_install problems under Solaris
To: packages <packages@netbsd.org>
From: Julien Letessier <julien.letessier@sun.com>
List: tech-pkg
Date: 08/19/2002 12:51:44
Hello packaging folks,

I decided to update my pkg_* tools recently, and it appears that the 
build is broken on Solaris for some reason---appearently related to 
large file support.

If anyone could help, or reports the same problem, it would be really 
cool, and I'd probably offer him/her a beer.

Symptoms:
   pkg_add fails because it says it doesn't find enough space (while
   there's 6GB free in /tmp).
   With -v, it says the space left on the device is <0...

Cause:
   A few printf's later, it appears that off_t is a 32 bit unsigned
   integer (on my machine). In lib/pen.c, min_free() multiplies two
   off_t's and returns an overflowed off_t (number of free bytes in a
   device, wich certainly doesn't fit in 32 bits).

Context:
   SunOS mikdemia 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-Enterprise
   (with Zoularis + pkgsrc)

Solutions I tried:
   Eventually, I tried a few preprocessor macros:
   * _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE don't do anything at all.
   * _FILE_OFFSET_BITS=64 breaks the build, with a weird:
     $ gcc -O2 -D_FILE_OFFSET_BITS=64  -Werror  -I/usr/pkg/bsd/include
     -D__EXTENSIONS__ -D_XPG4_2 -DSUNOS_5_8   (...) -c file.c
     file.c: In function `isemptyfile':
     file.c:133: invalid operands to binary !=
   * patching lib/pen.c/min_free() to return an uint64_t. this works (of
     course) but is pretty dirty...

Please tell me I've done something stupid, because not having a 
functional pkg_* toolset really hurts.

Cheers,
-- 
Julien T. Letessier
Sun Labs Europe, Meylan, France
julien.letessier@sun.com