Subject: SVR4 compat: can't get current directory?
To: None <current-users@NetBSD.ORG>
From: Todd Vierling <tv@pobox.com>
List: current-users
Date: 10/25/1997 11:47:41
On sparc -current as of yesterday, using Solaris 2.5.1 libs and bins under
SVR4 compat, many programs are failing with a "can't get current directory" 
error.  I even tried the /usr/bin/pwd program which returns the same error
and a partial ktrace (starting right after loading of shared libraries) is
attached below.  The pwd does _not_ fail when cwd = /, but it fails in any
other directory.  I don't know how long it has been like this as I haven't
been using SVR4 compat lately. 

It looks like Solaris' getcwd() is trying to stat / and compare some of the
struct stat internals (inode number? device number?) against ., .., etc. 
Why that is failing is beyond me.... 

   319 pwd      CALL  stat(0xeffff1e0,0xeffff154)
   319 pwd      NAMI  "./"
   319 pwd      RET   stat 0
   319 pwd      CALL  break(0x20e88)
   319 pwd      RET   break 0
   319 pwd      CALL  break(0x22e88)
   319 pwd      RET   break 0
   319 pwd      CALL  stat(0x100ec21c,0xeffff0cc)
   319 pwd      NAMI  "/emul/svr4/"
   319 pwd      NAMI  "/emul/svr4"
   319 pwd      NAMI  "/"
   319 pwd      RET   stat 0
   319 pwd      CALL  open(0xeffff1e0,0x4,0x100c0834)
   319 pwd      NAMI  "./../"
   319 pwd      RET   open 3
   319 pwd      CALL  fcntl(0x3,0x2,0x1)
   319 pwd      RET   fcntl 0
   319 pwd      CALL  fstat(0x3,0xefffebd8)
   319 pwd      RET   fstat 0
   319 pwd      CALL  fstat(0x3,0xeffff154)
   319 pwd      RET   fstat 0
   319 pwd      CALL  open(0x100ec228,0,0x1b6)
   319 pwd      NAMI  "/emul/svr4/etc/mnttab"
   319 pwd      NAMI  "/etc/mnttab"
   319 pwd      RET   open -1 errno 2 No such file or directory
   319 pwd      CALL  getdents(0x3,0x212b8,0x418)
   319 pwd      RET   getdents 0
   319 pwd      CALL  close(0x3)
   319 pwd      RET   close 0
   319 pwd      CALL  write(0x2,0x107c8,0x29)
   319 pwd      GIO   fd 2 wrote 41 bytes
       "pwd: cannot determine current directory!
       "
   319 pwd      RET   write 41/0x29
   319 pwd      CALL  lseek(0,0,0x1)
   319 pwd      RET   lseek 9035/0x234b
   319 pwd      CALL  exit(0x2)

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