Subject: SVR4 compat (again): can't truncate file via fcntl(?)...
To: None <current-users@NetBSD.ORG>
From: Todd Vierling <tv@pobox.com>
List: current-users
Date: 10/27/1997 20:20:10
Well, here's more SVR4 woes, on sparc architecture with Solaris 2.5.1 bins.

Firstly, the auditsys syscall is unimplemented and breaks with a
psignal(p,SIGSYS).  Could this fail quietly with SVR4_ENOSYS, or do we know
too little to let the call pass?  It makes some programs fail in rather
strange places. 

Secondly, can someone pull up src/sys/compat/svr4/svr4_misc.c from trunk
into 1.3 branch?  (Are trunk pullups being done at all?)  It fixes the
problem I posted last about getdents.

Thirdly, and the subject line of this post; it seems some Solaris programs
(pkginstall in particular) are trying to "truncate" a file via fcntl.
In the partial ktrace here, pkginstall (a subprocess of pkgadd) is opening a
file in a mock Solaris root tree, which works fine.  The fcntl here fails,
though, and I can't see whats returning errno 89:

  1160 pkginstall CALL  open(0xefffd860,0x1,0)
  1160 pkginstall NAMI  "/emul/svr4/emul/svr4new/var/sadm/install/t.contents"
  1160 pkginstall NAMI  "/emul/svr4new/var/sadm/install/t.contents"
  1160 pkginstall RET   open 10/0xa
  1160 pkginstall CALL  fcntl(0xa,0xb,0xefffd77c)
  1160 pkginstall RET   fcntl -1 errno 89 Unknown error: 89
  1160 pkginstall CALL  close(0xa)
  1160 pkginstall RET   close 0
  1160 pkginstall CALL  write(0x2,0x4fe08,0x6)
  1160 pkginstall GIO   fd 2 wrote 6 bytes
       "pkgadd"
  1160 pkginstall RET   write 6
  1160 pkginstall CALL  write(0x2,0x33db6,0x9)
  1160 pkginstall GIO   fd 2 wrote 9 bytes
       ": ERROR: "
  1160 pkginstall RET   write 9
  1160 pkginstall CALL  write(0x2,0x2f5b8,0x2a)
  1160 pkginstall GIO   fd 2 wrote 42 bytes
       "unable to truncate temporary contents file"

=====
== Todd Vierling (Personal tv@pobox.com; Business tv@lucent.com)
== I know you like the Internet, Bobby.  Now go eat your Frosted Flakes.